Home > Backend Development > PHP Tutorial > 为什么iconv把不识别的字符转换成0,该如何解决

为什么iconv把不识别的字符转换成0,该如何解决

WBOY
Release: 2016-06-13 10:14:35
Original
1000 people have browsed it

为什么iconv把不识别的字符转换成0

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $str = "100㎡面积";$content=iconv("gb2312","utf-8//ignore",$str);echo $content;?>
Copy after login

会输出 “1000面积”,ignore的意思不是忽略吗,怎么转换成0了?
如果用mb_convert_encoding()则会输出 “100?面积”
有没有好的方法处理

------解决方案--------------------
gb2312换成gbk
------解决方案--------------------
因为 gb2312 是gbk的子集。很多特殊字符gb2312不支持。而gbk支持。
------解决方案--------------------
GBK是gb2312的扩展版本,有很多在gb2312没有对应编码的字符,GBK都有。
就好像GBK是php5,gb2312是php4,向下兼容并有扩充。
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