ASP中文和Unicode互转
- Public Function Tounicode(ByVal Str)
- Tounicode = ""
- Dim I
- For I = 1 To Len(Str)
- Tounicode = Tounicode & "\u" & LCase(Right("0000" & Cstr(Hex(AscW(Mid(Str,I,1)))),4))
- Next
- End Function
- Public Function Unicodeto(ByVal Str)
- Str = Replace(Str,"\u","")
- Unicodeto = ""
- Dim I
- For I = 1 To Len(Str) Step 4
- Unicodeto = Unicodeto & ChrW(Cint("&H" & Mid(Str,I,4)))
- Next
- End Function
复制代码 |