打印本文 打印本文  关闭窗口 关闭窗口  
字符串如何转换回中文
作者:不详  文章来源:瓷都热线http://cidu.net  点击数  更新时间:2003/4/13  文章录入:不详  责任编辑:不详

有关接受传值的代码:
Do While Len(gstrFormData) < gintContentLength
rc = ReadFile(ghStdIn, ByVal sBuff, gintContentLength, lBytesRead, ByVal 0&)
gstrFormData = gstrFormData & Left$(sBuff, lBytesRead)
Loop

输入——<INPUT type="hidden" value ="测试数据" name="testfield">
得到的数值却是testfield=%B2%E2%CA%D4%CA%FD%BE%DD

如何把这个字串转回中文?


Function chinese2unicode(AA)
Dim i
Dim AA_one
Dim AA_unicode
For i = 1 To Len(AA)
AA_one = Mid(AA, i, 1)
AA_unicode = AA_unicode & Chr(38)
AA_unicode = AA_unicode & Chr(35)
AA_unicode = AA_unicode & Chr(120)
AA_unicode = AA_unicode & Hex(AscW(AA_one))
AA_unicode = AA_unicode & Chr(59)
Next
Me.Caption = AA_unicode
End Function

将GB数组的类型从Unicode编码转换为系统缺省码
bteGB = StrConv(strSource, vbFromUnicode)

打印本文 打印本文  关闭窗口 关闭窗口