jacky
2006-08-19 10:47:07 UTC
Hi,
I am trying to retrieving the data in a field with type as char(32) .
The database is on i-series The Chinese people enter data in to this
field in Chinese by Shift-Out - then Chinese Character and then
Shift-In .
Now when I am trying to retrive this information, using a vb.net and
updating our global CRM system . Sql Datareader is used to fetch data
using IBM Client access OLEDB Provider.
(1) Method -1
select DBCLOB(fieldname) from library.filename
, I am getting the data with traditional chinese character and not in
simplified Chinese character, but the english text in the filed is
getting retrieved correctly. This works fine for Populating from our
Taiwan system as they use Traditional Chinese.
(2) Method-2
I also tried by taking
select hex(fieldname) from library.filename
and then using following function (getunicodestring) with codepage 936
, after getting byte array using the function Hex2Byte(passing the
string from the select statement), still I couldn't get the proper
chinese characters.
Could any one help me out in getting the text properly.
thnaks & regards
Jacky
--------
Public Function getunicodestring(ByVal arrByte_source As Byte(),
ByVal i_codepage As
Integer) As String
Dim arrByte_unicode As Byte()
Dim enc_source As System.Text.Encoding =
System.Text.Encoding.GetEncoding(i_codepage)
Dim enc_unicode As System.Text.Encoding =
System.Text.Encoding.Unicode
Dim str_unicode As String
arrByte_unicode = System.Text.Encoding.Convert(enc_source,
enc_utf16, arrByte_source)
str_unicode = enc_utf16.GetString(arrByte_UTF16)
Return str_unicode
End Function
----------
Function Hex2Byte(ByVal HexValue As String) As Byte()
Dim X
Dim ByteArray() As Byte
Dim a As System.Text.ASCIIEncoding
HexValue = Replace(HexValue, " ", "")
ReDim ByteArray((Len(HexValue) \ 2) - 1)
For X = 0 To UBound(ByteArray) - 2
ByteArray(X) = CLng("&H" & Mid$(HexValue, 2 * X + 1, 2))
Next
Hex2Byte = ByteArray
End Function
I am trying to retrieving the data in a field with type as char(32) .
The database is on i-series The Chinese people enter data in to this
field in Chinese by Shift-Out - then Chinese Character and then
Shift-In .
Now when I am trying to retrive this information, using a vb.net and
updating our global CRM system . Sql Datareader is used to fetch data
using IBM Client access OLEDB Provider.
(1) Method -1
select DBCLOB(fieldname) from library.filename
, I am getting the data with traditional chinese character and not in
simplified Chinese character, but the english text in the filed is
getting retrieved correctly. This works fine for Populating from our
Taiwan system as they use Traditional Chinese.
(2) Method-2
I also tried by taking
select hex(fieldname) from library.filename
and then using following function (getunicodestring) with codepage 936
, after getting byte array using the function Hex2Byte(passing the
string from the select statement), still I couldn't get the proper
chinese characters.
Could any one help me out in getting the text properly.
thnaks & regards
Jacky
--------
Public Function getunicodestring(ByVal arrByte_source As Byte(),
ByVal i_codepage As
Integer) As String
Dim arrByte_unicode As Byte()
Dim enc_source As System.Text.Encoding =
System.Text.Encoding.GetEncoding(i_codepage)
Dim enc_unicode As System.Text.Encoding =
System.Text.Encoding.Unicode
Dim str_unicode As String
arrByte_unicode = System.Text.Encoding.Convert(enc_source,
enc_utf16, arrByte_source)
str_unicode = enc_utf16.GetString(arrByte_UTF16)
Return str_unicode
End Function
----------
Function Hex2Byte(ByVal HexValue As String) As Byte()
Dim X
Dim ByteArray() As Byte
Dim a As System.Text.ASCIIEncoding
HexValue = Replace(HexValue, " ", "")
ReDim ByteArray((Len(HexValue) \ 2) - 1)
For X = 0 To UBound(ByteArray) - 2
ByteArray(X) = CLng("&H" & Mid$(HexValue, 2 * X + 1, 2))
Next
Hex2Byte = ByteArray
End Function