Categories
CS

PHP “&#xXXX” 转换为汉字

用正则表达式提取内容的时候 防止变为了 形如 江瀚 的乱码

用一下函数可以转换为汉字

$studentName = mb_convert_encoding($studentName, ‘UTF-8’, ‘HTML-ENTITIES’);

这种形式的 江 的乱码其实是Unicode的16进制表达

 

java 版本 Html编码转换(&#数字型)

php 字符串转换相关 http://www.jb51.net/article/9387.htm

http://www.php.net/mb_convert_encoding

Leave a Reply

Your email address will not be published. Required fields are marked *