Copy Code code as follows:
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
<%Session.CodePage=65001%>
<!--#include file= "base64.asp"-->
<%
Function Aspurldecode (strvalue)
Dim varary, Varelement, objstream, Lngloop, Flag
strvalue = Replace (strvalue, "+", "")
Varary = Split (strvalue, "%")
Flag = varary (0) = ""
Set objstream = Server.CreateObject ("ADODB. Stream ")
With Objstream
. Type = 2
. Mode = 3
. Open
For each varelement in Varary
If varelement <> Empty Then
If Len (varelement) >= 2 and Flag Then
. WRITETEXT ChrB (CInt ("&h" & Left (Varelement, 2))
For lngloop = 3 to Len (varelement)
. WRITETEXT ChrB (ASC (varelement, Lngloop, 1))
Next
Else
For lngloop = 1 to Len (varelement)
. WRITETEXT ChrB (ASC (varelement, Lngloop, 1))
Next
Flag = True
End If
End If
Next
. WRITETEXT Chr (0)
. Position = 0
Aspurldecode = Replace (Convunicode (. ReadText), Chr (0), "", 1,-1, 0)
On Error Resume Next
. Close
Set objstream = Nothing
End With
End Function
Function Convunicode (ByVal strdata)
Dim RS, STM, Bytary, Intlen
If Len (Strdata & "") > 0 Then
Strdata = MidB (strdata, 1)
Intlen = LenB (strdata)
Set rs = Server.CreateObject ("ADODB.") Recordset ")
Set stm = Server.CreateObject ("ADODB.") Stream ")
With RS
. Fields.Append "X", 205, Intlen
. Open
. AddNew
RS (0). AppendChunk strdata & ChrB (0)
. Update
Bytary = RS (0). GetChunk (Intlen)
End With
With STM
. Type = 1
. Open
. Write bytary
. Position = 0
. Type = 2
. Charset = "Utf-8"
Convunicode =. ReadText
End With
End If
On Error Resume Next
Stm. Close
Set stm = Nothing
Rs. Close
Set rs = Nothing
End Function
%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<body>
<%
' Base64 encoded, compared to. NET more 77u/
Response.Write ("Base64 Code:" &base64encode ("O ' Nan") & "<br/>")
' Base64 after decoding
Response.Write ("Base64 after decoding:" &base64uncode ("6ZI/5LYA5QWG") & "<br/>")
%>
</body>