473,698 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3767

<wo******@sohu. comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.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.goo glegroups.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.goog legroups.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.goo glegroups.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
7770
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 DB and display it onscreen. No matter which way I open the file, convert it to Unicode/leave it as is or what ever, I see all single bytes ok, but double bytes become 2 seperate single bytes. Surely there is an easy way to convert these mixed...
4
7945
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 to work (the in and output remains the same): string x=toUTF8("=?GB2312?B?s8q5q8u+vq3A7aGissbO8bK/w8W1xNK7t+LQxQ==?=","GB2312");
1
2018
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 'encoded-word' as is explained in rfc2047), by using Convert.FromBase64String as Stefen kindly suggested (my post from yesterday).
0
1447
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 perfectly, but i am having problem when setting the label of my page to some chinese character during run-time which i do it from the code behind i realize the chinese will displayed correctly if i opened
2
2266
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. I tried to do a simple string replace to replace \ to : but it turns out the only string you can't replace in c# is \ as it gives the error "Invalid Escape Sequence" - using "\\" or @"\" doesnt work either
10
8061
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
3
13771
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 exactly I should do. Please give me some sample code if you could. Thanks a lot Regards, Gary
0
5060
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 get the db to translate to UTF-8 for non technical reasons. So I have a string coming back with the character œ (ISO value 156). this character appears in .NET as a box character because 156 is not a valid Unicode character value. I have been...
19
5333
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 str(object) does not always attempt to return a string that is acceptable to eval(); its goal is to return a printable string. If no argument is given, returns the empty string, ''.
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8898
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7734
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.