accent ajax encoding issue

后端 未结 2 872
遥遥无期
遥遥无期 2021-01-22 06:12

Source file has:

header(\'Content-type: text/html; charset=iso8859-1\');

Source ajax (jQuery) script is:

$(document).ready         


        
2条回答
  •  有刺的猬
    2021-01-22 06:23

    This is because you are displaying UTF-8 encoding of é (0xc3, 0xa9) as Latin-1. So the search_word was encoded as UTF-8 when it posted to PHP.

    Try this,

    $.ajaxSetup({
            scriptCharset: "iso-8859-1",
            cache: false
    });
    

提交回复
热议问题