Problems with Apache and special characters

This is a discussion on Problems with Apache and special characters within the PHP Language forums, part of the PHP Programming Forums category; Hi. Running Apache/2.0.52 on Linux, I've got problems with special characters (Spanish tildes) on my pages. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-13-2004
tarmstrong@gmail.com
 
Posts: n/a
Default Problems with Apache and special characters

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.

Reply With Quote
  #2 (permalink)  
Old 12-13-2004
Michael Fesser
 
Posts: n/a
Default Re: Problems with Apache and special characters

.oO(tarmstrong@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
Reply With Quote
  #3 (permalink)  
Old 12-13-2004
Pedro Graca
 
Posts: n/a
Default Re: Problems with Apache and special characters

tarmstrong@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!
Reply With Quote
  #4 (permalink)  
Old 12-13-2004
Michael Fesser
 
Posts: n/a
Default Re: Problems with Apache and special characters

.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
Reply With Quote
  #5 (permalink)  
Old 12-13-2004
Dani CS
 
Posts: n/a
Default Re: Problems with Apache and special characters

tarmstrong@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.

Reply With Quote
  #6 (permalink)  
Old 12-14-2004
John Dunlop
 
Posts: n/a
Default Re: Problems with Apache and special characters

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
Reply With Quote
  #7 (permalink)  
Old 12-14-2004
Dani CS
 
Posts: n/a
Default Re: Problems with Apache and special characters

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.
Reply With Quote
  #8 (permalink)  
Old 12-15-2004
Michael Fesser
 
Posts: n/a
Default Re: Problems with Apache and special characters

.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
Reply With Quote
  #9 (permalink)  
Old 12-15-2004
Michael Fesser
 
Posts: n/a
Default Re: Problems with Apache and special characters

.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
Reply With Quote
  #10 (permalink)  
Old 12-15-2004
Tony Marston
 
Posts: n/a
Default Re: Problems with Apache and special characters


"Michael Fesser" <netizen@gmx.net> wrote in message
news:hp7vr0d2p1gpaem0uqu0theupl7cd90083@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




Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:32 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0