Connecting Tech Pros Worldwide Help | Site Map

Problems with Apache and special characters

tarmstrong@gmail.com
Guest
 
Posts: n/a
#1: Jul 17 '05
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.

Michael Fesser
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Problems with Apache and special characters


.oO(tarmstrong@gmail.com)
[color=blue]
>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).[/color]

Post an URL.

Micha
Pedro Graca
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Problems with Apache and special characters


tarmstrong@gmail.com wrote:[color=blue]
> 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).[/color]

Looks like some sort of Unicode.
[color=blue]
> My test page is:
> -------------------------
> <html>
> <h1>España</h1>
> </html>
> -------------------------[/color]

Are you sure your test page isn't encoded in UTF-8 or Unicode or
whatever (something different than ISO-8859-1)?
[color=blue]
> 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.[/color]

It's a problem of both and neither: they're not in synch!
[color=blue]
> Any suggestion? Thank you very much.[/color]

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!
Michael Fesser
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Problems with Apache and special characters


.oO(Pedro Graca)
[color=blue]
>Try:
>
> <h1>Espa&ntilde;a</h1>
>
>and the encodings for your server and pages no longer matter :-)[/color]

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

Micha
Dani CS
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Problems with Apache and special characters


tarmstrong@gmail.com wrote:[color=blue]
> 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
> -------------------[/color]

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).
[color=blue]
>
> I don't know wether it's a problem of my webpages or of my webserver.
> Any suggestion? Thank you very much.[/color]

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.

John Dunlop
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Problems with Apache and special characters


Dani CS wrote:
[color=blue]
> -place the appropiate <meta> tag in your files[/color]

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
Dani CS
Guest
 
Posts: n/a
#7: Jul 17 '05

re: Problems with Apache and special characters


John Dunlop wrote:[color=blue]
> Dani CS wrote:
>
>[color=green]
>>-place the appropiate <meta> tag in your files[/color]
>
>
> 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.
>[/color]

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.
Michael Fesser
Guest
 
Posts: n/a
#8: Jul 17 '05

re: Problems with Apache and special characters


.oO(Dani CS)
[color=blue]
>Instructing the server is easy when all the documents use the same
>encoding.[/color]

I consider that as it should be.
[color=blue]
>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).[/color]

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

Micha
Michael Fesser
Guest
 
Posts: n/a
#9: Jul 17 '05

re: Problems with Apache and special characters


.oO(John Dunlop)
[color=blue]
>Dani CS wrote:
>[color=green]
>> -place the appropiate <meta> tag in your files[/color]
>
>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.[/color]

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
Tony Marston
Guest
 
Posts: n/a
#10: Jul 17 '05

re: Problems with Apache and special characters



"Michael Fesser" <netizen@gmx.net> wrote in message
news:hp7vr0d2p1gpaem0uqu0theupl7cd90083@4ax.com...[color=blue]
> .oO(John Dunlop)
>[color=green]
>>Dani CS wrote:
>>[color=darkred]
>>> -place the appropiate <meta> tag in your files[/color]
>>
>>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.[/color]
>
> 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[/color]

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




John Dunlop
Guest
 
Posts: n/a
#11: Jul 17 '05

re: Problems with Apache and special characters


Michael Fesser wrote:
[color=blue]
> 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 ...[/color]

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:c5jjd9$2elhn$1@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
Michael Fesser
Guest
 
Posts: n/a
#12: Jul 17 '05

re: Problems with Apache and special characters


.oO(Tony Marston)
[color=blue]
>Not if you supply that information on an HTTP header, as in:-
>
>header('content-type:text/html; charset=UTF-8');[/color]

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
Michael Fesser
Guest
 
Posts: n/a
#13: Jul 17 '05

re: Problems with Apache and special characters


.oO(John Dunlop)
[color=blue]
>See also news:c5jjd9$2elhn$1@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.)[/color]

Then use the "old" Google Groups. ;)

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

Interesting thread BTW.

Micha
Closed Thread