Private Sub Command1_Click()
VBA.MsgBox DecodeString("http://myserver/%c9%fa%b2%fa%b2%bf/")
End Sub
Public Function DecodeString(StringX As String) As String
Dim i As Long
Dim sByte() As Byte
Do Until i > VBA.Len(VBA.Trim(StringX)) ' - 1
i = i + 1
If VBA.Mid(StringX, i, 1) <> "%" Then
DecodeString = DecodeString & VBA.Mid(StringX, i, 1)
Else
i = i + 1
ReDim sByte(0) As Byte
sByte(0) = VBA.Val("&H" & VBA.Mid(StringX, i, 2))
If Val("&H" & VBA.Mid(StringX, i, 2)) > 128 Then
i = i + 3
ReDim Preserve sByte(1) As Byte
sByte(1) = VBA.Val("&H" & VBA.Mid(StringX, i, 2))
DecodeString = DecodeString & VBA.StrConv(sByte, vbUnicode)
Else
DecodeString = DecodeString & VBA.StrConv(sByte, vbUnicode)
End If
i = i + 1
End If
Loop
End Function
URL 编码解码程序 (VB CGI、Winsock 提交 Web 含汉字表单域要用到)!
http://www.csdn.net/expert/topic/357/357810.shtm