Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 10:59 AM
tarmstrong@gmail.com
Guest
 
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.

  #2  
Old July 17th, 2005, 10:59 AM
Michael Fesser
Guest
 
Posts: n/a
Default 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
  #3  
Old July 17th, 2005, 10:59 AM
Pedro Graca
Guest
 
Posts: n/a
Default 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!
  #4  
Old July 17th, 2005, 10:59 AM
Michael Fesser
Guest
 
Posts: n/a
Default 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
  #5  
Old July 17th, 2005, 11:00 AM
Dani CS
Guest
 
Posts: n/a
Default 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.

  #6  
Old July 17th, 2005, 11:01 AM
John Dunlop
Guest
 
Posts: n/a
Default 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
  #7  
Old July 17th, 2005, 11:01 AM
Dani CS
Guest
 
Posts: n/a
Default 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.
  #8  
Old July 17th, 2005, 11:01 AM
Michael Fesser
Guest
 
Posts: n/a
Default 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
  #9  
Old July 17th, 2005, 11:01 AM
Michael Fesser
Guest
 
Posts: n/a
Default 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
  #10  
Old July 17th, 2005, 11:01 AM
Tony Marston
Guest
 
Posts: n/a
Default 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




  #11  
Old July 17th, 2005, 11:01 AM
John Dunlop
Guest
 
Posts: n/a
Default 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
  #12  
Old July 17th, 2005, 11:01 AM
Michael Fesser
Guest
 
Posts: n/a
Default 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
  #13  
Old July 17th, 2005, 11:01 AM
Michael Fesser
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools

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

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles