By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

problem about convert utf8 to gbk

P: n/a
hi all,

i need to covert the utf8 character to gbk,is that possible?Any idea
will be appreciate.
Jan 18 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Bart Van der Donck wrote:

    Examples (cut&paste):
     ��˽���� (GBK)
     ���ŷֲ� (GBK)
     CD����� 15��R ����� (mix Latin/GBK)
Sorry for the wrong encoding. Here is the right one:
http://www.dotinternet.be/temp/gbk.htm

--
Bart


Jan 18 '08 #2

P: n/a
hi Bart,

I have some questions:

Do you mean the charset of our webpage has nothing to do with the
encoding of the user's input?

can you give me some links resource for my reference/

i have tried your code,when i input:
中国与世界同步

output in the next textarea:中56fd与4e16界540c步NaN

Thanks for your great work!

Jan 24 '08 #3

P: n/a
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
Jan 24 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.