encode| Code | function
<%
' Coding.inc.asp
' All Rights Reserved, Room3rd@hotmail.com
Function Encode (Str)
dim Count, Pos, Ch, Code
dim sweetch
Characters in Sweetch that do not need to be encoded
sweetch = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz_{}[]" ()
encode = "
count = Len (Str)
pos = 1
do while Pos<=count
& nbsp Ch = Mid (Str, Pos, 1)
code = ASC (ch)
if code>=0 and code<256 then& nbsp; ' Kanji not processed
if ch<> "%" Then
if InStr (Sweetch, Ch) =0 Then
ch = "%" & Right ("0" & Hex (Code), 2)
end If
else
ch = "%25"
end if
end if
encode = Encode & Ch
pos = Pos + 1
loop
End Function
Function Decode (STR)
Dim Count, Pos, Ch, Code
Decode = ""
Count = Len (STR)
Pos = 1
Do While Pos<=count
Ch = Mid (Str, Pos, 1)
If ch= "%" Then
If Pos+2<=count Then
Ch = Chr (InStr ("0123456789ABCDEF", UCase (Mid (str, pos+1, 1))-1) * + InStr ("0123456789ABCDEF", UCase (Mid (str, pos+2, 1 ))-1)
Else
' Coded string is incorrect
Ch = ""
End If
pos = pos + 2
End If
Decode = Decode & Ch
pos = pos + 1
Loop
End Function
%>