|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
.net编码转换问题
Dim str As String = "广西南宁市"
Dim a() As Byte
a = System.Text.Encoding.GetEncoding("GB2312").GetBytes(str)
str = System.Text.Encoding.UTF8.GetString(a)
Response.Write(str)
For i = 0 To UBound(a) - 1
Response.Write(a(i) & ",")
Next
我用上面的方式可以得到
185,227,206,247,196,207,196,254,202,
Do While (True)
z = r.ReadBytes(1)
y = z(0)
Response.Write(y & ",")
If z(0) < 1 Then Exit Do
'如果是高字节
If z(0) > 127 Then
GetStr = GetStr & System.Text.Encoding.GetEncoding("GB2312").GetString(z)
Else
GetStr = GetStr & Chr(z(0))
End If
Loop
Response.Write(y & ",")的结果也是这个啊... 为什么就不能正常显示出中文呢。
185,227,206,247,196,207,196,254,202,208, |
我汗哦。。。掉到这么下面。。。 怎么没有人给点思路或者想法什么的吗? |
|