asp에서는 URLEncode 함수만 제공 하고 decode함수는 제공하지 않는다.
iis에서 자동으로 처리하기 때문이라고 하는데..
파일에 쓴다든지 여러경우에 decode함수가 필요하다.
간단히 설명하면 + 는 공백으로 126이상의 ansi코드를 가져서 %다음에 16진수로 되어 있는것을 되돌리는 것이다.
유용하게 쓰시길
데브피아에서 참고
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
strTemp = strTemp & " "
lngCurrent = lngCurrent + 1
elseIf 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
날짜: 2004-09-30 17:00:13,
조회수: 2767 |