|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Convert the code from gb2312 to unicode in ASPHi,
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. <wood0***@sohu.com> wrote in message
news:1160504126.469137.300130@i42g2000cwa.googlegroups.com... Where do you get the character from to start with?> 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. > If it's part of a file that is encoded using gb2312 then an ADODB.Stream object may be what you need. 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: Show quoteHide quote > 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. <wood0***@sohu.com> wrote in message
Show quoteHide quote news:1160518281.597623.171690@i42g2000cwa.googlegroups.com... How are you retrieving this data? What data type is being used to store the> 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? > data? Access uses unicode to store text data so this should not be an issue. Show quoteHide quote > 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. > 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 onecharacter 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: Show quoteHide quote > 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. <wood0***@sohu.com> wrote in message
news:1160571644.491356.325200@m7g2000cwm.googlegroups.com... I need to see some code. The code you are using to create values in the DB> 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). > 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. Show quoteHide quote > 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. > 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 following2, 206, 206 206, 210, 206, 210 I think what I want is impposible In ASP only.... I should give up :( Anthony Jones wrote: Show quoteHide quote > 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. <wood0***@sohu.com> wrote in message
Show quoteHide quote news:1160610280.012866.145230@c28g2000cwb.googlegroups.com... I don't. Access stores characters as Unicode. Response.Write encodes> 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 :( > 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. Show quoteHide quote > 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. >
Other interesting topics
retreiving data from html page
Quizz script performance bug -- too many questions? interesting problem... call store procedure for inserting data in asp SMTP how can i detect multiplt VBNewLine's in a row Assign Javascript value to asp session variable XML - load contents onto page. how to run a bat file in remote PC through ASP Running Bat file from ASP on Windows Server x64 problem. |
|||||||||||||||||||||||