472,338 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,338 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 3685

<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...
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. ...
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 ...
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...
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...
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...
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...
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...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.