T
Tim Streater
I have what was originally a gb2312 string, mime-encoded. Here is an
example:
=?gb2312?B?otUtxvMg0rUg1dAgxrggViBTIMPmIMrUILy8IA==?=
This I decode, convert to UTF-8, and store in an SQLite database. That
string I then retrieve and use as a response to an ajax request from a
browser. So far, this is all PHP, but bare with me.
In the browser, the ajax responseText is taken and put in a table cell
as the cell's innerText, and the cell proceeds to display Chinese
characters.
Now, if I look at the responseText with e.g. string.charCodeAt(),
instead of seeing a series of UTF-8 bytes, I see a series of (large)
unicode values which correspond to the Chinese characters displayed.
So, where is this apparently automatic UTF-8 -> unicode conversion
taking place? Can someone point me at a description of the process?
In fact, there are two places on the browser page where this
responseText might be displayed (the data is retrieved at different
times using different ajax calls and different PHP scripts). In one
place what's displayed appears to be OK, but in another, a *second*
conversion seems to be happening and I'm trying to pin this down.
example:
=?gb2312?B?otUtxvMg0rUg1dAgxrggViBTIMPmIMrUILy8IA==?=
This I decode, convert to UTF-8, and store in an SQLite database. That
string I then retrieve and use as a response to an ajax request from a
browser. So far, this is all PHP, but bare with me.
In the browser, the ajax responseText is taken and put in a table cell
as the cell's innerText, and the cell proceeds to display Chinese
characters.
Now, if I look at the responseText with e.g. string.charCodeAt(),
instead of seeing a series of UTF-8 bytes, I see a series of (large)
unicode values which correspond to the Chinese characters displayed.
So, where is this apparently automatic UTF-8 -> unicode conversion
taking place? Can someone point me at a description of the process?
In fact, there are two places on the browser page where this
responseText might be displayed (the data is retrieved at different
times using different ajax calls and different PHP scripts). In one
place what's displayed appears to be OK, but in another, a *second*
conversion seems to be happening and I'm trying to pin this down.