기타 개발관련2015. 4. 24. 11:45


UTF-8 페이지에서 사용할것.


한글, 특수문자도 잘됨. 


<%

FUNCTION URLDecode(str)

'// This function:

'// - decodes any utf-8 encoded characters into unicode characters eg. (%C3%A5 = å)

'// - replaces any plus sign separators with a space character

'//

'// IMPORTANT:

'// Your webpage must use the UTF-8 character set. Easiest method is to use this META tag:

'// <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

'//

    Dim objScript

    Set objScript = Server.CreateObject("ScriptControl")

    objScript.Language = "JavaScript"

    URLDecode = objScript.Eval("decodeURIComponent(""" & str & """.replace(/\+/g,"" ""))")

    Set objScript = NOTHING

END FUNCTION


aa = "한글 썄헇 다횋뛣韓初めまして。婦妇廣→广Dedicăm talentul şi tehnologia noastră pentru a crea produse şi"

bb = Server.URLEncode(aa)

cc = URLDecode(bb)


Response.write aa &"<br>"

Response.write bb &"<br>"

Response.write cc &"<br>"


%>


Posted by requireme