httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krist van Besien" <>
Subject Re: [users@httpd] please help - adding Chinese character sets to Apache
Date Mon, 18 Aug 2008 07:43:17 GMT
On Sun, Aug 17, 2008 at 01:08, Zach Uram <> wrote:

> <meta http-equiv="Content-Language" content="zh-cn">
> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
> I think my Apache is not serving the GB2312 charset. So I looked here:

Apache does not "serve" character sets. Apache will pass a html page
on to the browser, which will render it. The browser guesses what
charset the use to display the page based on a lot of different items.
Headers passed along with the response, meta headers in the html
etc... Sometimes the browser guesses wrongly what the correct
character set is. You can then set the charset manually (in firefox
choose view/character encoding) and this ought to make the page render
Offcourse you want this to happen automatically. Your problem is
probably due to apache not responding with the correct content-type
header. What you should do is the following:
- Use a tool that allows you to see the whole request, including
headers. You are allready using wget, you could use the following
command:  wget --debug <url>, and use this to fetch both the page from
the original server and from your own server. Watch the "Content-Type"
header. If this header is not correct on your server you have found
the cause of your problem.

If your server sends the wrong content-type header (which I'm fairly
sure is the source of your problem) you need to indeed add an
"AddCharset" directive. This directive looks like this:

AddCharset <character map> <extention>


AddCharset  gb2312 .gb

would add charset gb2312 to the content-type header for all files with
an extention ending in .gb. So you would need to rename all your files
encoded in gb2312. The same would apply if you want to use big5

If all your gb2312 encoded files are in the same directory (or in
directories sharing a common root) than you could use something like

<Directory /var/www/chinesesite/>
AddDefaultCharset gb2312

This way all files from this directory will get served with a
content-type header with the gb2312 charset.

A last tip: If you rename all your gb2312 encoded files to something
like you don't need to change all the links to these
pages if you set the following option.
Option +Multiviews
This way if a request comes for index.html, but no index.html exists
apache will search for index.html.*. You couuld then even have both an
with the proper character set assigned to each using AddCharset.
Apache will then serve one of both files when a request for index.html
comes, depending on what the browser prefers.


Bremgarten b. Bern, Switzerland
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message