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. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
.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 |
|
|||
|
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ñ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! |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
.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 |
|
|||
|
.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 |
|
|||
|
"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 |