ASP 에서 사용하실 수 있는 URL Decode 함수 입니다.
찾아보니 ASP 에서는 URL encode 는 내장함수로 지원을 하는데 decode 는 지원하지 않는것 같더군요...
그래서 decode 는 아래 함수를 활용해서 사용하시면 됩니다.
-
Public Function URLDecode(str)
-
-
Dim strTemp
-
Dim strChar
-
Dim strHex
-
Dim strHex1
-
Dim strDec
-
Dim strDec1
-
Dim lngCurrent
-
Dim nAsciiVal
-
Dim bDone
-
lngCurrent=1
-
-
While Not bDone
-
-
If Mid(str, lngCurrent, 1) = "%" Then
-
-
strHex = Mid(str, lngCurrent + 1, 2)
-
-
If strHex <> "" Then
-
If CInt("&H" & strHex) > 127 Then
-
lngCurrent = lngCurrent + 3
-
strHex1 = Mid(str, lngCurrent + 1, 2)
-
strDec = Chr(CInt("&H" & strHex & strHex1))
-
strTemp = strTemp & strDec
-
lngCurrent = lngCurrent + 3
-
Else
-
strDec = Chr(CInt("&H" & strHex))
-
strTemp = strTemp & strDec
-
lngCurrent = lngCurrent + 3
-
End If
-
End If
-
-
Else
-
-
strTemp = strTemp & Mid(str, lngCurrent, 1)
-
lngCurrent = lngCurrent + 1
-
-
End If
-
-
If lngCurrent > Len(str) Then
-
bDone = True
-
End If
-
-
Wend
-
-
URLDecode = strTemp
-
-
End Function