By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Problems with Apache and special characters

P: n/a
Hi.

Running Apache/2.0.52 on Linux, I've got problems with special
characters
(Spanish tildes) on my pages. I can see them correctly on my machine
(España), but
not on my web server (España).

My test page is:
-------------------------
<html>
<h1>España</h1>
</html>
-------------------------

Within my 'httpd.conf' I set:
-------------------
AddDefaultCharset ISO-8859-1
-------------------

I don't know wether it's a problem of my webpages or of my webserver.
Any suggestion? Thank you very much.

Jul 17 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
.oO(ta********@gmail.com)
Running Apache/2.0.52 on Linux, I've got problems with special
characters
(Spanish tildes) on my pages. I can see them correctly on my machine
(España), but
not on my web server (España).


Post an URL.

Micha
Jul 17 '05 #2

P: n/a
ta********@gmail.com wrote:
Running Apache/2.0.52 on Linux, I've got problems with special
characters (Spanish tildes) on my pages. I can see them
correctly on my machine (España), but
not on my web server (España).
Looks like some sort of Unicode.
My test page is:
-------------------------
<html>
<h1>España</h1>
</html>
-------------------------
Are you sure your test page isn't encoded in UTF-8 or Unicode or
whatever (something different than ISO-8859-1)?
Within my 'httpd.conf' I set:
-------------------
AddDefaultCharset ISO-8859-1
-------------------

I don't know wether it's a problem of my webpages or of my webserver.
It's a problem of both and neither: they're not in synch!
Any suggestion? Thank you very much.


Try:

<h1>Espa&ntilde;a</h1>

and the encodings for your server and pages no longer matter :-)

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #3

P: n/a
.oO(Pedro Graca)
Try:

<h1>Espa&ntilde;a</h1>

and the encodings for your server and pages no longer matter :-)


I would rather fix the encoding issue instead of using entities.

Micha
Jul 17 '05 #4

P: n/a
ta********@gmail.com wrote:
Hi.

Running Apache/2.0.52 on Linux, I've got problems with special
characters
(Spanish tildes) on my pages. I can see them correctly on my machine
(España), but
not on my web server (España).

My test page is:
-------------------------
<html>
<h1>España</h1>
</html>
-------------------------

Within my 'httpd.conf' I set:
-------------------
AddDefaultCharset ISO-8859-1
-------------------
Try using UTF-8 instead. Your file is being served as ISO-8859-1 but
it's really encoded with UTF-8 (you get ñ when you try to decode a
UTF-8 'ñ' with the ISO-8859-1 decoder).

I don't know wether it's a problem of my webpages or of my webserver.
Any suggestion? Thank you very much.


You can else:
-tell your text editor to save your files using ISO-8859-1, or
-place the appropiate <meta> tag in your files so that the server and/or
browser know how to decode the file.

Jul 17 '05 #5

P: n/a
Dani CS wrote:
-place the appropiate <meta> tag in your files


Fine; but that's no substitute for HTTP headers. Even
though a server might form HTTP headers from http-equivs, I
see no reason not to remove any doubt and instruct the
server yourself.

--
Jock
Jul 17 '05 #6

P: n/a
John Dunlop wrote:
Dani CS wrote:

-place the appropiate <meta> tag in your files

Fine; but that's no substitute for HTTP headers. Even
though a server might form HTTP headers from http-equivs, I
see no reason not to remove any doubt and instruct the
server yourself.


Instructing the server is easy when all the documents use the same
encoding. But this situation is far from real in many environments (eg.
my own machine -- Kate on Linux insists on UTF-8, but Crimson Editor on
Windows is stuck with ISO-8859-1).

However, there's a "per-file" way to instruct the server on encodings,
apart from <meta> tags:

<?php header("Content-Tye: text/html; charset=..."); ?>

This should work fine, but should be placed at the begining of those
files that don't use the default encoding assumed by the server.
Moreover, I believe that some programs exist that automagically guess
the encoding of a file; such a program could be executed for each file
served, and its output prepended in a Content-Type header. Downsides
are: significant performance hit, and possible wrong guesses that drive
the cliente mad.

Un saludo,
Dani.
Jul 17 '05 #7

P: n/a
.oO(Dani CS)
Instructing the server is easy when all the documents use the same
encoding.
I consider that as it should be.
But this situation is far from real in many environments (eg.
my own machine -- Kate on Linux insists on UTF-8, but Crimson Editor on
Windows is stuck with ISO-8859-1).


I would decide for one encoding and then only use software that's
capable of handling it.

Micha
Jul 17 '05 #8

P: n/a
.oO(John Dunlop)
Dani CS wrote:
-place the appropiate <meta> tag in your files


Fine; but that's no substitute for HTTP headers. Even
though a server might form HTTP headers from http-equivs, I
see no reason not to remove any doubt and instruct the
server yourself.


The whole situation with the meta-charset-thing is rather paradox: The
information about the used encoding is stored inside the document, so
the UA has to decode the document first to know how to decode it ...

Stupid.

Micha
Jul 17 '05 #9

P: n/a

"Michael Fesser" <ne*****@gmx.net> wrote in message
news:hp********************************@4ax.com...
.oO(John Dunlop)
Dani CS wrote:
-place the appropiate <meta> tag in your files


Fine; but that's no substitute for HTTP headers. Even
though a server might form HTTP headers from http-equivs, I
see no reason not to remove any doubt and instruct the
server yourself.


The whole situation with the meta-charset-thing is rather paradox: The
information about the used encoding is stored inside the document, so
the UA has to decode the document first to know how to decode it ...

Stupid.

Micha


Not if you supply that information on an HTTP header, as in:-

header('content-type:text/html; charset=UTF-8');

--
Tony Marston
http://www.tonymarston.net


Jul 17 '05 #10

P: n/a
Michael Fesser wrote:
The whole situation with the meta-charset-thing is rather paradox: The
information about the used encoding is stored inside the document, so
the UA has to decode the document first to know how to decode it ...


The HTML4.01 spec says:

| The META declaration must only be used when the character
| encoding is organized such that ASCII-valued bytes stand
| for ASCII characters (at least until the META element is
| parsed). META declarations should appear as early as
| possible in the HEAD element.

http://www.w3.org/TR/html401/charset...-char-encoding

See also news:c5************@ID-114100.news.uni-berlin.de .

(Sorry, I don't know how best to refer to threads in groups-
beta (spit). That's the message-id of the first article.)

--
Jock
Jul 17 '05 #11

P: n/a
.oO(Tony Marston)
Not if you supply that information on an HTTP header, as in:-

header('content-type:text/html; charset=UTF-8');


That's how it's supposed to be. If I do it correctly in the server's
response header I don't need that meta-thing anymore.

Micha
Jul 17 '05 #12

P: n/a
.oO(John Dunlop)
See also news:c5************@ID-114100.news.uni-berlin.de .

(Sorry, I don't know how best to refer to threads in groups-
beta (spit). That's the message-id of the first article.)


Then use the "old" Google Groups. ;)

http://groups.google.com/groups?thre....uni-berlin.de

Interesting thread BTW.

Micha
Jul 17 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.