JQUERY 使用 load 中文亂碼 怎麼解決啊?

來源:互聯網
上載者:User
JQUERY 使用 load 中文亂碼 怎麼解決啊?

2個檔案都是 gbk2312 a.html load擷取 b.html 中文亂碼 怎麼解決啊?

我百度沒找到


回複討論(解決方案)

1.UTF-8
2.

1.UTF-8
2.



我用 2個頁面用 NOTEPAD++ 儲存 GB2312編碼 並且 也加了

還是不行

直接返回 b.html 是不可以的
必須對 b.html 轉碼或通過 php發出字元集聲明

  

當有參數傳遞時,參數必須做 utf-8 到 gbk 轉碼

直接返回 b.html 是不可以的
必須對 b.html 轉碼或通過 php發出字元集聲明

   

當有參數傳遞時,參數必須做 utf-8 到 gbk 轉碼



請問下 要是以後網站產生HTML 怎麼辦呢?

如果你使用 ajax 的話,還是 utf-8 比較好

直接返回 b.html 是不可以的
必須對 b.html 轉碼或通過 php發出字元集聲明

   

當有參數傳遞時,參數必須做 utf-8 到 gbk 轉碼




請問下 要是以後網站產生HTML 怎麼辦呢?

請問版主 有沒有什麼完美解決方案呢? 能給個思路嗎

如果你使用 ajax 的話,還是 utf-8 比較好



我有個站是 GB2313 資料庫也是 我想共用資料庫 所以這個比較麻煩 唉



如果你使用 ajax 的話,還是 utf-8 比較好




   //post或get發送資料的索引值對    this.keys = Array();    this.values = Array();    this.keyCount = -1;    this.sendlang = 'gb2312';    //要求標頭類型    this.rtype = 'text';    //初始化xmlhttp    //IE6、IE5    if(window.ActiveXObject) {        try { DedeXHTTP = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { }        if (DedeXHTTP == null) try { DedeXHTTP = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { }    }    else {        DedeXHTTP = new XMLHttpRequest();    }    //增加一個POST或GET索引值對    this.AddKeyN = function(skey,svalue) {        if(this.sendlang=='utf-8') this.AddKeyUtf8(skey, svalue);        else this.AddKey(skey, svalue);    };        this.AddKey = function(skey,svalue) {        this.keyCount++;        this.keys[this.keyCount] = skey;        svalue = svalue+'';        if(svalue != '') svalue = svalue.replace(/\+/g,'$#$');        this.values[this.keyCount] = escape(svalue);    };    //增加一個POST或GET索引值對    this.AddKeyUtf8 = function(skey,svalue) {        this.keyCount++;        this.keys[this.keyCount] = skey;        svalue = svalue+'';        if(svalue != '') svalue = svalue.replace(/\+/g,'$#$');        this.values[this.keyCount] = encodeURI(svalue);    };


我看了下織夢 是這樣的

將load將要載入的html用記事本開啟,另存新檔時下面有個編碼,選utf–8,儲存即可,親測可用

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.