zoukankan      html  css  js  c++  java
  • 字符乱码解决方法

    用Post方法提交数据时,提交了一个很长的字符串,总是提示没有权限。
    var objhttp= new ActiveXObject("msxml2.xmlhttp");
    objhttp.open("Post","jzh_receive.aspx?jzh="+strxml,false);
    objhttp.send();
    zbzy=objhttp.responsetext
    strxml长度不固定

    --------------------------------------------------------------------------------

    objhttp.open("Post","jzh_receive.aspx?jzh="+strxml,false);
    strxml数据很长,不应该用这种方法,用
    strA = "submit1=Submit&text1=scsdfsd";//Looks like QueryString,But there's no "?" here!
    var oReq = new ActiveXObject("MSXML2.XMLHTTP");
    oReq.open("POST","jzh_receive.aspx",false);
    oReq.setRequestHeader("Content-Length",strA.length);
    oReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");//没有这句就玩不转拉
    oReq.send(strA);

    --------------------------------------------------------------------------------

    http://dotnet.aspx.cc/ShowDetail.aspx?id=ATV1GLXT-65FF-4M82-CT5U-B1J65D3ZN2OK

    --------------------------------------------------------------------------------

    TO:net_lover(孟子E章)
    提交到服务器端后汉字全变成了乱字符,怎么解决???

    --------------------------------------------------------------------------------

    strA = "submit1=Submit&text1="+strxml;
    var oReq = new ActiveXObject("MSXML2.XMLHTTP");
    oReq.open("POST","jzh_receive.aspx",false);
    oReq.setRequestHeader("Content-Length",strA.length);
    oReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
    孟先生提供的这个方法可以,但是提交到服务端后出现乱字符。
    孟先生又给了下面这个方法,但是下面这段代码,怎么加到上面代码里?
    xmlhttp.setRequestHeader("Content-Type","text/xml")
    <%
    Response.ContentType = "text/xml"
    Response.CharSet = "GB2312"
    %>

    --------------------------------------------------------------------------------

    gz

    --------------------------------------------------------------------------------

    直接加在當前頁面的頂部。

  • 相关阅读:
    fail-fast以及Iterator对象
    LeetCode~1351.统计有序矩阵中的负数
    LeetCode~75.颜色分类
    LeetCode~5364. 按既定顺序创建目标数组
    LeetCode~945.使数组唯一的最小增量
    LeetCode~409. 最长回文串
    笔记: SpringBoot + VUE实现数据字典展示功能
    JSON parse error: Cannot deserialize value of type `java.util.Date` from String
    为什么要用location的hash来传递参数?
    初识Git
  • 原文地址:https://www.cnblogs.com/QDuck/p/615284.html
Copyright © 2011-2022 走看看