Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XMLHTTP POST로 전송시 한글이 깨집니다..

428 views
Skip to first unread message

깍꾸

unread,
Apr 30, 2007, 1:50:24 AM4/30/07
to
보내는쪽의 소스입니다.
 
get으로 보낼때는 한글도 안깨지고 잘되었습니다.
 
그런데 post로 변경하고 x.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 이거 추가하니깐
 
한글이 깨집니다.
 
전송하는 데이터가 textarea라 용량이 많은데. get으로는 안되서여 반드시 post 로 해야되는디.
 
한글이....

 
---- send.asp ------
 
<SCRIPT LANGUAGE="JavaScript">
<!--
 function viewCal()
 {
  fn_Contents = document.Frm_Contents.txt_Contents.value ;
 
  var x = new ActiveXObject("MSXML2.XMLHTTP")
  x.open("post","http://<%=Server_Name%>/Log_Manage/Process.asp",false);
 
  x.setRequestHeader("Accept-Language", "ko");
  x.setRequestHeader("Accept-Encoding", "gzip, deflate");
  x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  x.send("Contents="+fn_Contents+"");
  var strv = x.responseBody;
  document.all.d.innerHTML = BinDecode(strv);
 
 }
//-->
</SCRIPT>
 
<script language="vbscript">
'-----------------------------------------
' BinDecode (바이너리 -> 아스키 변환)
' mongmong - 2003. 2
'-----------------------------------------
 Public Function BinDecode(byVal binData)
  Dim i, byteChr, strV
  For i = 1 to LenB(binData)
   byteChr = AscB(MidB(binData,i,2))
   If byteChr > 127 Then
    i = i + 1
    strV = strV & Chr("&H" & Hex(byteChr) & Hex(AscB(MidB(binData,i,2))))
   Else
    strV = strV & Chr(byteChr)
   End if
  Next
 
  BinDecode = strV
 
 End Function
 
</script>
   <table  width="90%" height="100%" border="0" cellspacing="0" cellpadding="0" >
   <Form method="post" name="Frm_Contents">
    <tr >
     <td ><textarea name="txt_Contents" style="width:100%; height:100%; overflow:auto; border:0px; ></textarea></td>
    </tr>
   </Form>
   </table>
 
--- process.asp ----
<%
 Contents = Request("Contents")
 
--> 디비에 인서트합니다. 다음에 다시 셀랙트해서 아래와 같이 뿌려줍니다.
 
 Response.Write Contents

%>
 
 
 
 
 
 
 

정영탁

unread,
Apr 30, 2007, 2:19:57 AM4/30/07
to
보내실때, 인코딩을 시켜야 할 것 같은데요.

x.send("Contents=" + escape(fn_Contents) + "");


"깍꾸" <kus...@paran2.com>> wrote in message
news:euI55tui...@TK2MSFTNGP04.phx.gbl...

깍꾸

unread,
Apr 30, 2007, 2:27:06 AM4/30/07
to
헉...
이런일이..... 졸라 황당해서 멍하니 안자잇는중입니다.
 
영탁님 감사합니다....
 
 
0 new messages