티스토리 뷰
PHP 에서는 iconv() 라는 훌륭한 함수가 존재하지만
Classic ASP 에서는 지원되지 않아 난감하다
부르는 쪽에서는 값을 escape 태그로 감싼다
$('#orderInfo').load('./x.ajax.asp', { 'orderId':''+ escape($('#orderId').val()) +'', 'orderName':''+ escape($('#orderName').val()) +'' });
답하는 쪽에서는 Unescape() 함수를 사용하여 변환해준다
<%@ CodePage=949 Language="VBScript"%>
<%
Session.CodePage = "949"
Response.CharSet = "euc-kr"
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.AddHeader "Expires","0"
Response.CacheControl = "no-cache"
Response.ContentType = "text/html" '"application/json"
%>
<!-- #include virtual = "/inc/lib.asp" -->
<%
orderId = Request.Form("orderId")
orderName = Request.Form("orderName")
orderId = Unescape(orderId)
orderName = Unescape(orderName)
......
function Unescape(str)
dim rtnStr
rtnStr = ""
dim i, t
for i=1 to len(str)
t = mid(str, i, 1)
if t="%" then
if mid(str, i+1, 1)="u" then
rtnStr = rtnStr & chrB("&H"&mid(str, i+4, 2)) & chrB("&H"&mid(str, i+2, 2))
i = i+5
else
rtnStr = rtnStr & chrB("&H"&mid(str, i+1, 2))
i = i+2
end if
else
rtnStr = rtnStr&t
end if
next
Unescape = rtnStr
end function
%>
Classic ASP 에서는 지원되지 않아 난감하다
부르는 쪽에서는 값을 escape 태그로 감싼다
$('#orderInfo').load('./x.ajax.asp', { 'orderId':''+ escape($('#orderId').val()) +'', 'orderName':''+ escape($('#orderName').val()) +'' });
답하는 쪽에서는 Unescape() 함수를 사용하여 변환해준다
<%@ CodePage=949 Language="VBScript"%>
<%
Session.CodePage = "949"
Response.CharSet = "euc-kr"
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.AddHeader "Expires","0"
Response.CacheControl = "no-cache"
Response.ContentType = "text/html" '"application/json"
%>
<!-- #include virtual = "/inc/lib.asp" -->
<%
orderId = Request.Form("orderId")
orderName = Request.Form("orderName")
orderId = Unescape(orderId)
orderName = Unescape(orderName)
......
function Unescape(str)
dim rtnStr
rtnStr = ""
dim i, t
for i=1 to len(str)
t = mid(str, i, 1)
if t="%" then
if mid(str, i+1, 1)="u" then
rtnStr = rtnStr & chrB("&H"&mid(str, i+4, 2)) & chrB("&H"&mid(str, i+2, 2))
i = i+5
else
rtnStr = rtnStr & chrB("&H"&mid(str, i+1, 2))
i = i+2
end if
else
rtnStr = rtnStr&t
end if
next
Unescape = rtnStr
end function
%>
'웹프로그래밍 > js' 카테고리의 다른 글
http, https 혼용 Ajax 레이어팝업 로그인과 처리 (1) | 2010.05.13 |
---|---|
[javascript] 문자 찾기 (0) | 2010.04.08 |
JSON Parse~parsing (1) | 2010.01.28 |
[jQuery] DateTime Picker (0) | 2010.01.23 |
[jQuery] validate showErrors 로 에러메세지 출력 (0) | 2010.01.14 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- iis
- Android
- JQuery
- 워드프레스
- nginx
- git
- 안드로이드
- Docker
- Wordpress
- PHP
- laravel
- Linux
- macos
- Prototype
- iphone
- 한글
- javascript
- IOS
- IE
- Mac
- nodejs
- API
- classic asp
- CSS
- centos
- ASP
- sencha touch
- JSON
- mssql
- Debug
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함