Home > Backend Development > PHP Tutorial > 编码变换不了,怪了

编码变换不了,怪了

WBOY
Release: 2016-06-13 10:34:50
Original
855 people have browsed it

编码转换不了,怪了

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->var_dump($message);$charset = mb_detect_encoding($message);$message = iconv('UTF-8','GBK//IGNORE',$message);//$message = mb_convert_encoding($message, 'GBK', 'UTF-8');$charset2 = mb_detect_encoding($message);var_dump($charset,$charset2,$message);
Copy after login


输出:
string '灏婃暚鐨刴ytest_0鎮ㄥソ锛佹偍鐨勮鍗?20120717-1504-6317宸叉敹鍒帮紝璇峰敖蹇?氳繃缃戜笂閾惰浠樻78.000鍏冿紝绁濇偍閲囪喘鎰夊揩锛佹湇鍔$儹绾匡細4001156677' (length=159)
string 'UTF-8' (length=5)
string 'UTF-8' (length=5)
string '灏婃暚鐨刴ytest_0鎮ㄥソ锛佹偍鐨勮鍗?20120717-1504-6317宸叉敹鍒帮紝璇峰敖蹇?氳繃缃戜笂閾惰浠樻78.000鍏冿紝绁濇偍閲囪喘鎰夊揩锛佹湇鍔$儹绾匡細4001156677' (length=159)

改变文件本身的编码也还是UTF-8

有人吗?在线等

------解决方案--------------------
试试加上
header("Content-Type:text/html;charset=utf-8");
------解决方案--------------------
error_reporting(E_ALL);

header("Content-Type:text/html;charset=utf-8");

是无BOM的UTF8吗?

有BOM可能是header失效
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template