分享你我的心得.
共乘一片美好网络.

asp编码解码

<%

Public Function UrlDecode(ByVal Val)
If IsNull(Val) Then URLDecode = “” : Exit Function
If Instr(Val, “%”) <= 0 Then UrlDecode = val : Exit Function
Dim I, Char, Uchar, Cod, Result : Result = Empty
Val = Replace(Val, “+”, ” “)
For I = 1 To Len(Val)
Char = Mid(Val, I, 1)
Uchar = Mid(Val, I + 1, 1)
If Char = “%” and Instr(“0123456789ABCDEF”, Uchar) > 0 Then
Result = Result & ChrB(“&H” & Mid(Val, I + 1, 2))
I = I + 2
Else
Result = Result & ChrB(AscB(Char))
End If
Next
With Server.CreateObject(“Adodb.Stream”)
.Type = 2
.Mode = 3
.Open
.WriteText Result
.Position = 0
.Charset = “GB2312”
.Position = 2
UrlDecode = .ReadText
.Close
End With
End Function

%>

gb2312的编码转码

赞(0)
未经允许不得转载:小叶白龙博客 » asp编码解码
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!