shop-wiz logo
Follow Us on Facebook Follow Us on Google+ Follow Us on Twitter Follow Us on LinkedIn
제목 euc-kr 을 utf-8로 utf-8 을 euc-kr 로 바꾸기
등록일 2009.04.29 HIT 38183 작성자 폰돌
utf-8 을 ecu-kr
이것은 utf-8을 자바스크립트로 escape 시켜서 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="949"%>
<% Response.CharSet = "euc-kr" %> 
<%
bb = unescape(Request("bb"))  
sample = Request("sample") 
sample1 = unescape(Request("sample1"))  
Response.Write bb & "<br>"
Response.Write sample & "<br>"
Response.Write sample1 & "<br>"
%>


<% @LANGUAGE='VBSCRIPT' CODEPAGE='65001' %>
<% Response.CharSet = "utf-8" %>
<script>
function checkForm(f){
    f.sample1.value = escape(f.sample.value);

}
</script>
<form Method="POST" name="user" action="kor8.asp" onsubmit="return checkForm(this)">
<input type="hidden" name="bb" value="<%=escape("가나다라마바사")%>"> 

<input type="image" src="zzzzzzz.jpg">
<input type="hidden" name="sample1" id="textfield" />
<input type="text" name="sample" id="textfield" />
</form>


euc-kr 을 utf-8로
이것은 걍 함수를 사용

Public Function toUTF8(szSource As String) As String
    On Error GoTo ErrHandler

    Dim szChar As String
    Dim WideChar As Long
    Dim nLength As Integer
    Dim i As Integer
    
    nLength = Len(szSource)
    For i = 1 To nLength
        szChar = Mid(szSource, i, 1)

        If Asc(szChar) < 0 Then
            WideChar = CLng(AscB(MidB(szChar, 2, 1))) * 256 + AscB(MidB(szChar, 1, 1))
            
            If (WideChar And &HFF80) = 0 Then
                toUTF8 = toUTF8 & "%" & Hex(WideChar)
            ElseIf (WideChar And &HF000) = 0 Then
                toUTF8 = toUTF8 & _
                            "%" & Hex(CInt((WideChar And &HFFC0) / 64) Or &HC0) & _
                            "%" & Hex(WideChar And &H3F Or &H80)
            Else
                toUTF8 = toUTF8 & _
                            "%" & Hex(CInt((WideChar And &HF000) / 4096) Or &HE0) & _
                            "%" & Hex(CInt((WideChar And &HFFC0) / 64) And &H3F Or &H80) & _
                            "%" & Hex(WideChar And &H3F Or &H80)
            End If
        Else
            toUTF8 = toUTF8 + szChar
        End If
    Next
    Exit Function
    
ErrHandler:
    toUTF8 = ""
End Function

utf8.asp
<% @LANGUAGE='VBSCRIPT' CODEPAGE='65001' %>
<% Response.CharSet = "utf-8" %>
<form Method="POST" name="user" action="kor8.asp">
<input type="hidden" name="bb" value="<%=escape("가나다라마바사")%>"> 
<input type="image" src="zzzzzzz.jpg"></form>

kor8.asp<%@LANGUAGE="VBSCRIPT" CODEPAGE="949"%>
<% Response.CharSet = "euc-kr" %> <%bb = unescape(Request("bb"))  
Response.Write bb & "<br>"%>
댓글보기
안녕하세요 좋은 정보 감사합니다. 2012.12.11 X

Powered by shop-wiz since 2002, e-mail:wangta69@naver.com