473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert the code from gb2312 to unicode in ASP

Hi,

I know the code of a character is -12590, do you know how to convert to
the character in ASP (It is a Chinese character in gb2312 format)? Or,
do you know how to convert this -12590 to its unicode format 25105
without using gb2312-unicode table.

Thank you in advance.

Oct 10 '06 #1
7 3755

<wo******@sohu.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi,

I know the code of a character is -12590, do you know how to convert to
the character in ASP (It is a Chinese character in gb2312 format)? Or,
do you know how to convert this -12590 to its unicode format 25105
without using gb2312-unicode table.

Thank you in advance.
Where do you get the character from to start with?

If it's part of a file that is encoded using gb2312 then an ADODB.Stream
object may be what you need.
Oct 10 '06 #2
Anthony Jones,

Thank you for your response.

There are Chinese charecters stored in an Access database file. Each
Chinese character is represented by two bytes with their ascii>127. I
want to get the Chinese charecter from these two byts, or to calcutate
the character's unicode in ASP.

In ASP, I can get the characters from the database and I can convert
them into ascii numbers. Say, the two byts for a character are 206 and
210. I then get the character's code in gb2312 format by
206*256+210-65536 = -12590.

Until this point, I only know its code in gb2312 but still not get the
Chinese character.

What is ADODB.Stream object and can we use it in VBScript in ASP?

Anthony Jones wrote:
Where do you get the character from to start with?

If it's part of a file that is encoded using gb2312 then an ADODB.Stream
object may be what you need.
Oct 10 '06 #3

<wo******@sohu.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Anthony Jones,

Thank you for your response.

There are Chinese charecters stored in an Access database file. Each
Chinese character is represented by two bytes with their ascii>127. I
want to get the Chinese charecter from these two byts, or to calcutate
the character's unicode in ASP.

In ASP, I can get the characters from the database and I can convert
them into ascii numbers. Say, the two byts for a character are 206 and
210. I then get the character's code in gb2312 format by
206*256+210-65536 = -12590.

Until this point, I only know its code in gb2312 but still not get the
Chinese character.

What is ADODB.Stream object and can we use it in VBScript in ASP?
How are you retrieving this data? What data type is being used to store the
data?
Access uses unicode to store text data so this should not be an issue.
Anthony Jones wrote:
Where do you get the character from to start with?

If it's part of a file that is encoded using gb2312 then an ADODB.Stream
object may be what you need.

Oct 11 '06 #4
Anthony Jones,

I retrive the data from the database by normal recordset.
Didn't set any codepage in ASP when store them into the database, I
think that is ANSI by default.
Access uses unicode to store text data so this should not be an issue.
Than is something I don't understand. For example, if there is one
character in the field, after retrive it and assign it to a variable,
say myData, I found len(myData) = 2, although it is one character
(response.write myData will display a single character).

Anthony Jones wrote:
How are you retrieving this data? What data type is being used to store the
data?
Access uses unicode to store text data so this should not be an issue.
Oct 11 '06 #5

<wo******@sohu.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Anthony Jones,

I retrive the data from the database by normal recordset.
Didn't set any codepage in ASP when store them into the database, I
think that is ANSI by default.
Access uses unicode to store text data so this should not be an issue.
Than is something I don't understand. For example, if there is one
character in the field, after retrive it and assign it to a variable,
say myData, I found len(myData) = 2, although it is one character
(response.write myData will display a single character).
I need to see some code. The code you are using to create values in the DB
and code you use to retrieve it.

If you open the file in Access itself and open the table does the field
contain what you are expecting?

If Len(myData) = 2 then what does AscW(Mid(myData, 2, 1)) return?

It sounds like the data is damaged before it is entered in to the DB.

Anthony Jones wrote:
How are you retrieving this data? What data type is being used to store
the
data?
Access uses unicode to store text data so this should not be an issue.

Oct 11 '06 #6
Anthony Jones,

Using these code
response.write len(myData) & ", " & asc(myData) & ", " & ascW(myData)
& " <br>"
response.write asc(mid(myData,1,1)) & ", " & asc(mid(myData,2,1)) & ",
" & ascW(mid(myData,1,1)) & ", " & ascW(mid(myData,2,1)) & " <br>"
it will disply the following
2, 206, 206
206, 210, 206, 210

I think what I want is impposible In ASP only.... I should give up :(
Anthony Jones wrote:
I need to see some code. The code you are using to create values in the DB
and code you use to retrieve it.

If you open the file in Access itself and open the table does the field
contain what you are expecting?

If Len(myData) = 2 then what does AscW(Mid(myData, 2, 1)) return?

It sounds like the data is damaged before it is entered in to the DB.
Oct 11 '06 #7

<wo******@sohu.comwrote in message
news:11**********************@c28g2000cwb.googlegr oups.com...
Anthony Jones,

Using these code
response.write len(myData) & ", " & asc(myData) & ", " & ascW(myData)
& " <br>"
response.write asc(mid(myData,1,1)) & ", " & asc(mid(myData,2,1)) & ",
" & ascW(mid(myData,1,1)) & ", " & ascW(mid(myData,2,1)) & " <br>"
it will disply the following
2, 206, 206
206, 210, 206, 210

I think what I want is impposible In ASP only.... I should give up :(
I don't. Access stores characters as Unicode. Response.Write encodes
Unicode characters to the current codepage for the response. The only
reason I can think of (without seeing the code I needed to see) is that the
data stored in the Access DB is already messed up in someway. Garbage in,
garbage out.
Anthony Jones wrote:
I need to see some code. The code you are using to create values in the
DB
and code you use to retrieve it.

If you open the file in Access itself and open the table does the field
contain what you are expecting?

If Len(myData) = 2 then what does AscW(Mid(myData, 2, 1)) return?

It sounds like the data is damaged before it is entered in to the DB.

Oct 12 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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...
4
by: Albert Jan | last post by:
Hi, I have text from mime email messages with different encoding that I want to convert to utf-8, but I'm relatively new on encoding problems. I use the following code, but this doesn't seem...
1
by: Albert Jan | last post by:
Hi, in my quest to properly display email messages I have overcome the problem of decoding strings like "=?GB2312?B?s8q5q8u+vq3A7aGissbO8bK/w8W1xNK7t+LQxQ==?=" (which appears to be an...
0
by: Coco | last post by:
Hi! I have been searching for solution for the problem i am facing in displaying chinese character in my aspx page initially when i created the aspx page with some chinese chaarcter, it worked...
2
by: Joebloggs | last post by:
Hi I am trying to do an ldap lookup. I can pick up the domain name in the standard format DOMAIN\USERNAME. The problem is the company I work for expects the query in the format DOMAIN:USERNAME....
10
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
3
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or python 2.4 but I still don't have idea on what...
0
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...
19
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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
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—planning, coding, testing,...

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.