.netが文字化けしを解決するサイドゲート通路

2736 ワード

場合によっては、UFT-8の符号化の下でGB 2312データを他の局に提出して処理する必要があるかもしれません.
では、最も簡単な方法は次のとおりです.
Webでconfigにconfigurationラベルの下に次のコードを追加します.
(ファイル名はルートディレクトリが必要ですよ.)
                               
ホームページに次のフレームを追加

document.getElementById("pluginFra").src = "/sendContent_manage.aspx?to_userid=";
sendContent.htmlの内容は以下の通りです.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> </title>
</head>

<body>no
</body>
</html> 

sendContent_manage.aspxの内容は以下の通りです.
<%@ Page Language="C#" ContentType="text/html"  ResponseEncoding="gb2312"  %>
<%
    /**
     * ***********************************************
     * Author:prospertu
     * CreateDate:2015/11/14 11:18
     * Note: 
     * ************************************************
    */
    %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>send message</title>
</head>
<body>
<%    
    Page.Request.ContentEncoding = Encoding.GetEncoding("GB2312");
    Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
    
    Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
    Request.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
    
    Response.Charset = "936";
    string mobileNum = " ";    
    to_content = " ";    

    to_content = Server.UrlEncode(to_content);            
    string url_sendInfo = "http:// ?mobile=" + mobileNum + "&content=" + to_content;//tl=1
    Response.Write("<script>location.href='" + url_sendInfo + "';</script>");                
		
%>
</body>
</html>