Tech:Default Character Set in httpd.conf
From Wikitravel Shared
Moved from en:Wikitravel:Bug reports 1.4.x-1.5.x/Fixed by Evan
For the reason the default character set isn't working correctly anymore. I found on my test setup that the meta http-equiv tag wasn't enough and that I had to add utf-8 as the default charset of all .html files. Would you mind looking at it? Thanks! -- Mark 13:56, 19 Nov 2005 (EST)
- You think that's it? What a pain. --Evan 14:25, 19 Nov 2005 (EST)
- OK, I added a default charset, and it seems to be fixing the problem with the cached web pages. Good to know! I still haven't figured out how to stop the interface language from being changed, but that's a different problem. --Evan 14:29, 19 Nov 2005 (EST)
- Problem can be also elsewhere... (I had similar issue before.)
- In current configuration server returns encoding string in the headers, and this has priority over later http-equiv.
httpget http://wikitravel.org/en/Main_Page
GET /en/Main_Page HTTP/1.1 Host: wikitravel.org:80 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en-us,pl;q=0.5 No-Accept-Encoding: gzip,deflate,compress;q=0.9 Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive No-Transfer-Encoding: plain
HTTP/1.0 200 OK Date: Sat, 19 Nov 2005 18:51:34 GMT Server: Apache/2.0.50 (Fedora) Last-Modified: Fri, 18 Nov 2005 15:19:38 GMT ETag: "100c06d-9bc1-7736d680" Accept-Ranges: bytes Content-Length: 39873 Cache-Control: max-age=-99116 Expires: Fri, 18 Nov 2005 15:19:38 GMT Content-Type: text/html; charset=GB2312 Connection: keep-alive
- Interesting is that:
httpget http://wikitravel.org/
(...)
(...) Content-Type: text/html; charset=iso-8859-1 (...)
- This is probably because http://wikitravel.org/ address is handled by directly by Apache (URL rewriting?) while the en:Main Page by PHP through Apache.
- According to the docs, solution is to add following line in php.ini
; As of 4.0b4, PHP always outputs a character encoding by default in ; the Content-type: header. To disable sending of the charset, simply ; set it to be empty. ; ; PHP's built-in default is text/html default_mimetype = "text/html" ;default_charset = "iso-8859-1" default_charset =
- If it doesn't work, this should:
default_charset = "utf-8"
- --JanSlupski 14:44, 19 Nov 2005 (EST)
- Normally, the default charset should be explicitly set to "off" and not to a special char set; then the meta tag in the html file will be used. If the default charset set is not set to "off", then this char set will become dominant. Unger 04:56, 20 Nov 2005 (EST)
- I agree, but this sometimes fails to work. Probably a software bug. In case of Wikitravel, utf-8 is reasonable workaround. --JanSlupski 17:48, 20 Nov 2005 (EST)
- This is fixed, I think. --Evan 13:54, 3 Dec 2005 (EST)

