When passing parameters in ASP, there is a useful system function Server.URLEncode, you can convert some non-alphanumeric special symbols to the standard URL encoding (in fact, the 16 ASC code), which solves the problem of parameter passing, and then I thought that also provided the Server.urldecode, but after using But found that the program error, the original system did not provide this I imagine the decoding function. Do it yourself.
The principle of urlencode is actually very simple, that is, to convert the special characters into 16 ASC code value, then the decoding function as long as the 16 into the corresponding character of ASC is OK.
function UrlDecode (enstr) ' url decryption function Dim destr Dim C,i,v Destr= ' for I=1 to Len (enstr) C=mid (Enstr,i,
1) If c= "%" then V=eval ("&h" +mid (enstr,i+1,2)) if v<128 then DESTR=DESTR&CHR (v) I=i+2 else if Isvalidhex (Mid (enstr,i,3)) then if Isvalidhex (Mid (enstr,i+3,3)) Then
Eval ("&h" +mid (enstr,i+1,2) +mid (enstr,i+4,2)) DESTR=DESTR&CHR (v) i=i+5 Else V=eval ("&h" +mid (enstr,i+1,2) +cstr (Hex (ASC (Mid (enstr,i+3,1))) DESTR=DESTR&CHR (v) I
=i+3 End If Else destr=destr&c the end if if else if c= "+" then destr=destr& "" Else destr=destr&c End If Next urldecode=destr end Funct Ion function Isvalidhex (str) isvalidhex=true str=ucase (str) if Len (str) <>3 then Isvalidhex=false:exit funct Ion if Left (str,1) <> "%" then Isvalidhex=false:exit function C=mid (str,2,1) if not ((c>= "0") and (c<= "9")) or (c>= "A") and ( c<= "Z")) then Isvalidhex=false:exit function C=mid (str,3,1) if not ((c>= "0") and (c<= "9")) or ((c>= "A") and (c<= "Z")) then Isvalidhex=false:exit function End Function
The tested gb312 format is not a problem with ASP usage.