ACTIVE SERVER PAGE > URLDecode - UTF-8 ¹®ÀÚÇü½Ä µðÄÚµù ÇÏÀÚ.
µî·ÏÀÏ : 2017-07-04 18:12
Á¶È¸¼ö : 53,313
±âÁ¸¿¡ »ç¿ëÇÏ´ø URLDECODE ÇÔ¼ö°¡
Ư¼ö¹®ÀÚ ¶Ç´Â ÇÑÀÚ , ÀϺΠ¿Ü±¹¾î µî UTF-8 ¹®ÀÚ¿¿¡¼ Á¦´ë·Î DECODE µÇÁö ¾Ê´Â ¹®Á¦°¡ ÀÖ¾î¼
ã¾Æº¸¾Ò´õ´Ï ¹®Àڼ ¹®Á¦¿´½À´Ï´Ù.
³×À̹ö¿¡¼ °Ë»öÇؼ µé¾î¿Â URL À» È®ÀÎÇØ º¸¾Ò´Ù.
http://search.naver.com/search.naver?where=nexearch&query=%EC%97%94%ED%84%B0%EC%86%8C%ED%94%84%ED%8A%B8&sm=top_hty&fbm=1&ie=utf8
¾Æ½ºÅ°¹®ÀÚÀÎ URLDecode ÇÔ¼ö¸¦ »ç¿ëÇؼ º¯È¯ÇØ º¸¾Ò´Ù.
¾Æ·¡´Â °á°ú´Ù.
http://search.naver.com/search.naver?where=nexearch&query=???????????????&sm=top_hty&fbm=1&ie=utf8
query= ´ÙÀ½¹®ÀÚ°¡ ??????????????? ¿Í °°ÀÌ Á¦´ë·Î µðÄÚµùÀÌ ¾ÈµÇ´Â °ÍÀÌ´Ù.
¿øÀÎÀº ¹®Àڼ UTF-8 ·Î ÀÎÄÚµù µÇ¾î ÀÖ´ø °ÍÀÌ´Ù.
UTF-8 ·Î ÀÎÄÚµùµÈ°ÍÀº UTF-8 ÇüÅ·ΠµðÄÚµùÀÌ µÇ¾î¾ß ÇÑ´Ù.
¾Æ·¡´Â °á°ú´Ù.
1. http://search.naver.com/search.naver?where=nexearch&query=¿£ÅͼÒÇÁÆ®&sm=top_hty&fbm=1&ie=utf8
2. http://search.naver.com/search.naver?where=nexearch&query=¿£ÅͼÒÇÁÆ®&sm=top_hty&fbm=1&ie=utf8
»ç¿ë¹æ¹ýÀº
URLDecodeUTF8("¹®ÀÚ¿")
UrlDecode_GBToUtf8("¹®ÀÚ¿")
ÇÏ¸é µÈ´Ù.
°¢±â ´Ù¸¥ ÇÔ¼ö°¡ µÎ°³ Á¸ÀçÇÑ´Ù..... (°á°ú´Â °°´Ù)
À¯¿ëÇÏ°Ô »ç¿ëÇϱæ...
'------------------------------------------------------------------------------------
Public Function URLDecodeUTF8(byVal pURL)
Dim i, s1, s2, s3, u1, u2, result
pURL = Replace(pURL,"+"," ")
'?,%°¡ ¾ø´Ù¸é °Ë»öÇÒ ÇÊ¿ä¾øÀ½
if instr(1,pURL,"?",1) > 0 OR instr(1,pURL,"%",1) > 0 then
For i = 1 to Len(pURL)
if Mid(pURL, i, 1) = "%" then
s1 = CLng("&H" & Mid(pURL, i + 1, 2))
'2¹ÙÀÌÆ®ÀÏ °æ¿ì
if ((s1 AND &HC0) = &HC0) AND ((s1 AND &HE0) <> &HE0) then
s2 = CLng("&H" & Mid(pURL, i + 4, 2))
u1 = (s1 AND &H1C) / &H04
u2 = ((s1 AND &H03) * &H04 + ((s2 AND &H30) / &H10)) * &H10
u2 = u2 + (s2 AND &H0F)
result = result & ChrW((u1 * &H100) + u2)
i = i + 5
'3¹ÙÀÌÆ®ÀÏ °æ¿ì
elseif (s1 AND &HE0 = &HE0) then
s2 = CLng("&H" & Mid(pURL, i + 4, 2))
s3 = CLng("&H" & Mid(pURL, i + 7, 2))
u1 = ((s1 AND &H0F) * &H10)
u1 = u1 + ((s2 AND &H3C) / &H04)
u2 = ((s2 AND &H03) * &H04 + (s3 AND &H30) / &H10) * &H10
u2 = u2 + (s3 AND &H0F)
result = result & ChrW((u1 * &H100) + u2)
i = i + 8
end if
else
result = result & Mid(pURL, i, 1)
end if
Next
else
result = ""
end if
URLDecodeUTF8 = result
End Function
'------------------------------------------------------------------------------------
Function UrlDecode_GBToUtf8(ByVal str)
Dim B,ub
Dim UtfB
Dim UtfB1, UtfB2, UtfB3
Dim i, n, s
n=0
ub=0
For i = 1 To Len(str)
B=Mid(str, i, 1)
Select Case B
Case "+"
s=s & " "
Case "%"
ub=Mid(str, i + 1, 2)
UtfB = CInt("&H" & ub)
If UtfB<128 Then
i=i+2
s=s & ChrW(UtfB)
Else
UtfB1=(UtfB And &H0F) * &H1000
UtfB2=(CInt("&H" & Mid(str, i + 4, 2)) And &H3F) * &H40
UtfB3=CInt("&H" & Mid(str, i + 7, 2)) And &H3F
s=s & ChrW(UtfB1 Or UtfB2 Or UtfB3)
i=i+8
End If
Case Else
s=s & B
End Select
Next
UrlDecode_GBToUtf8 = s
End Function