I am having problems with encoding Chinese in an ASP site. The file formats are:
- translations.txt - UTF-8 (to store my translations)
- test.asp - UTF-8 - (to render the page)
test.asp is reading translations.txt that contains the following data:
Help|ZH|帮助
Home|ZH|首页
The test.asp splits on the pipe delimiter and if the user contains a cookie with ZH, it will display this translation, else it will just revert back to the Key value.
Now, I have tried the following things, which have not worked:
Add a meta tag
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>Set the
Response.CharSet = "UTF-8"- Set the
Response.ContentType = "text/html" - Set the Session.CodePage (and Response) to both 65001 (UTF-8)
- I have confirmed that the text in
translations.txtis definitely in UTF-8 and has no byte order mark - The browser is picking up that the page is Unicode UTF-8, but the page is displaying gobbledegook.
- The
Scripting.OpenTextFile(<file>,<create>,<iomode>,<encoding>)method returns the same incorrect text regardless of the Encoding parameter.
Here is a sample of what I want to be displayed in China (ZH):
- 首页
- 帮助
But the following is displayed:
- 首页
- 帮助
This occurs all tested browsers - Google Chrome, IE 7/8, and Firefox 4. The font definitely has a Chinese branch of glyphs. Also, I do have Eastern languages installed.
--
I have tried pasting in the original value into the HTML, which did work (but note this is a hard coded value).
- 首页
- 首页
However, this is odd.
首页 --(in hex)--> E9 A6 96 E9 A1 --(as chars)--> 首页
Any ideas what I am missing?