Home >php教程 >php手册 >解决编码为gb2312页面ajax交互汉字乱码问题

解决编码为gb2312页面ajax交互汉字乱码问题

WBOY
WBOYOriginal
2016-06-13 09:54:541449browse

解决编码为gb2312页面ajax交互汉字乱码问题
ajax只支持utf-8格式,不能支持gb2312编码格式,所以经常遇到gb2312的编码的程序使用ajax就出现乱码,刚找到一种解决方案是:

服务器端传送的数据仍是gb2312编码,客户端用js将汉字转变成utf8编码显示在页面

search.php教程
header("content-type: text/html; charset=gb2312");
include './search.htm';
?>

search.htm




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn