473,486 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problem about convert utf8 to gbk

hi all,

i need to covert the utf8 character to gbk,is that possible?Any idea
will be appreciate.
Jan 18 '08 #1
3 6718
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5032
by: sinasalek | last post by:
i have a problem with MySQL 4.1.x and UTF8. in version 4.0, i'm using html forms with utf8 charset for inserting unicode strings. but in version 4.1.x it is not working! if i change the charset of...
3
7719
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
15
2399
by: Peter Afonin | last post by:
Hello, I'm struggling with the string conversion to MD5 which I've never user before. I have a string that I need to encode which looks approximately like this: ...
3
52443
by: Jan Eliasen | last post by:
Hi I have a string, which I must convert into another string and have it utf-8 encoded. My current code looks like this; Both vDataIn and vDataOut are Objects (parameters to a...
2
7130
by: almurph | last post by:
Hi everyone, Can you help me please? I am having a problem with the encryption/decryption of words with the Irish fada in them. The Irish fada is like this: 衢眢/辽陀. It's kind of like the...
11
31723
by: ralphie | last post by:
hi all since nearly 2 days i fight with mssql and utf-8 as i need to store and retrieve arabic characters. i tried the com approach ...
8
20245
by: csanjith | last post by:
Hi, i have a situaion where i need to convert the characters entered in an text field to upper case using C. The configuration id utf8 environment in which user can enter any character (single ,...
4
21995
by: uday.sen | last post by:
Hi, I need to convert a string from UTF8 to wide character (wchar_t *). I perform the same in windows using: MultiByteToWideChar(CP_UTF8, 0, pInput, -1, pOutput, nLen); However, in linux...
1
5778
by: erikcw | last post by:
Hi, I'm trying to insert some data from an XML file into MySQL. However, while importing one of the files, I got this error: Traceback (most recent call last): File "wa.py", line 304, in ?...
0
5019
by: deloford | last post by:
Hi This is going to be a question for anyone who is an expert in C# Text Encoding. My situation is this: I have a Sybase database which is firing back ISO-8559 encoded strings. I am unable to...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project梡lanning, coding, testing,...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.