Re: UTF-8 output



John Fleck wrote:

On Thu, 2002-11-14 at 23:55, James Henstridge wrote:
jrb pointed this issue out on IRC.  If you look at the documentation at:
   http://developer.gnome.org/doc/API/2.0/glib/index.html

You will notice that it doesn't display the "Next >>>" link correctly (there is a little bit of garbage between "Next" and ">>>").

I investigated this problem, and it is because mozilla is interpreting the web page as being Latin1, while it is actually UTF-8 encoded (the garbage is the UTF-8 representation of a non-breaking space). This seems to be due to a conflict between the headers sent by the web server, and the <meta> tag in the page itself:

   Content-Type: text/html; charset=ISO-8859-1
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

The http headers take precedence, and disables the browser's encoding detection routines.

So am I understanding correctly here - the web server is ignoring the
actual encoding of the document (UTF-8 in this case) and automatically
informing the browser it's "charset=ISO-8859-1" no matter what it is?
If apache is configured with the "AddDefaultCharset" option, then it will add a charset option to the content type header for text/html documents, which will override any document specified charset (or one determined via heuristics).

Apparently an AddDefaultCharset directive was added to the default config file distributed with apache, as the automatic charset detection can apparently open up some cross site scripting problems in some situations (widget.gnome.org is configured this way, for instance).

In this particular case though, it is simply causing the web server to pick the wrong charset.

Getting gtkdoc to output HTML encoded as ISO-8859-1 or US-ASCII (all other characters encoded as character references) would work around this common web server configuration.

James.

--
Email: james daa com au              | Linux.conf.au   http://linux.conf.au/
WWW: http://www.daa.com.au/~james/ | Jan 22-25 Perth, Western Australia.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]