xinhaozh...@gmail.com wrote:
Do you mean the charset of our webpage has nothing to do with the
encoding of the user's input?
Please see below.
can you give me some links resource for my reference/
http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 http://en.wikipedia.org/wiki/UTF-8 http://en.wikipedia.org/wiki/GBK
i have tried your code,when i input:
....
output in the next textarea: .....
Thanks for your great work!
The left textarea needs to hold an UTF-8 string representing GBK
characters. It is not the intention to paste Chinese characters into
the left textarea, since those are no valid UTF-8 encodings.
If a code point up to 127 is pasted, it is treated as ASCII. Any code
point from the 128-255 range must always be manifested in pairs, since
UTF-8 uses a two-byte encoding to represent characters of the GBK
table. Code points above 256 (as your Chinese input) may never be used
in the left textarea, as they cannot be a valid UTF-8 encoding. Please
refer to the specifications of UTF-8 to see how multibyte-sequences
are used to represent one character.
If these conditions are not met for the left textarea, then the input
is not valid GBK as represented under UTF-8, and the outcome of the
conversion on the right side will be unreliable.
--
Bart