C
c.verma
I have a web application. There is a page which has a datagrid on
it.The datagrid displays the data that comes from SAP. SAP sends the
chinese characters to this grid. Before I display CHinese charactes, I
have to use the following code to let it display on the web page:
Public Function ToSCUnicode(ByVal str As String) As String
Dim enc1252 As System.Text.Encoding =
System.Text.Encoding.GetEncoding(1252)
Dim arrByte_GBK As Byte()
Dim arrByte_UTF16 As Byte()
Dim encGBK As System.Text.Encoding =
System.Text.Encoding.GetEncoding(936)
Dim encUTF16 As System.Text.Encoding =
System.Text.Encoding.Unicode
Dim strUTF16 As String
arrByte_GBK = enc1252.GetBytes(str)
arrByte_UTF16 = System.Text.Encoding.Convert(encGBK, encUTF16,
arrByte_GBK)
strUTF16 = encUTF16.GetString(arrByte_UTF16)
Return strUTF16
End Function
The web page has ALWAYS displayed the correct Chinese.
The SAME web page I display in excel using the below code:
If Request.QueryString("contenttype") = "excel" Then
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Me.EnableViewState = False
Response.Charset = ""
End If
Problem: Few records display Chinese characters fine in excel but few
display junk..
I have tired setting up the regional settings to Chinese. Nothing was
of any help.
Any ideas?
Thanks,
Chanda.
it.The datagrid displays the data that comes from SAP. SAP sends the
chinese characters to this grid. Before I display CHinese charactes, I
have to use the following code to let it display on the web page:
Public Function ToSCUnicode(ByVal str As String) As String
Dim enc1252 As System.Text.Encoding =
System.Text.Encoding.GetEncoding(1252)
Dim arrByte_GBK As Byte()
Dim arrByte_UTF16 As Byte()
Dim encGBK As System.Text.Encoding =
System.Text.Encoding.GetEncoding(936)
Dim encUTF16 As System.Text.Encoding =
System.Text.Encoding.Unicode
Dim strUTF16 As String
arrByte_GBK = enc1252.GetBytes(str)
arrByte_UTF16 = System.Text.Encoding.Convert(encGBK, encUTF16,
arrByte_GBK)
strUTF16 = encUTF16.GetString(arrByte_UTF16)
Return strUTF16
End Function
The web page has ALWAYS displayed the correct Chinese.
The SAME web page I display in excel using the below code:
If Request.QueryString("contenttype") = "excel" Then
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Me.EnableViewState = False
Response.Charset = ""
End If
Problem: Few records display Chinese characters fine in excel but few
display junk..
I have tired setting up the regional settings to Chinese. Nothing was
of any help.
Any ideas?
Thanks,
Chanda.