关于iconv容易忽略的参数IGNORE
来源:互联网 发布:centos 7安装桌面环境 编辑:程序博客网 时间:2024/05/21 12:07
$txtContent = iconv("utf-8",'GBK',$txtContent);
utf-8直接转gbk,这样问题就来了,当有些字符无法转换的时候就从此处断开,导致内容不完整。后来又重新查手册,才发现iconv还有两个可选的辅助参数:TRANSLIT和IGNORE ,(其中IGNORE 就是说遇到无法转换的就跳过)。 其实也怪自己太粗心,刚开始一看iconv函数参数就三个,而且例子中也没有特别的,就懒得去看英文解释了,直接使用,直到出现了问题。
Description
string iconv ( string in_charset, string out_charset, string str )
Performs a character set conversion on the string str fromin_charset to out_charset. Returns the converted string orFALSE on failure.
If you append the string //TRANSLIT toout_charset transliteration is activated. This means that when a character can't be represented in the target charset, it can be approximated through one or several similarly looking characters. If you append the string//IGNORE, characters that cannot be represented in the target charset are silently discarded. Otherwise,str is cut from the first illegal character.
http://hi.baidu.com/yukinzhang/blog/item/82ad8e811baaf3debc3e1ede.html
- 关于iconv容易忽略的参数IGNORE
- 关于iconv容易忽略的参数IGNORE
- 关于容易被忽略的C++特性
- 关于JSP中容易忽略的知识
- 关于C编程容易忽略的地方
- 关于TTL大家容易忽略的地方
- 容易忽略的问题
- makefile 中忽略错误参数.IGNORE、-k、-i的区别详解
- makefile 中忽略错误参数.IGNORE、-k、-i的区别详解
- 关于oracle sql优化的一个容易忽略的问题。
- 关于c语言中容易忽略的问题
- 关于JVM一个容易被忽略的小问题
- 关于slave的replicate-ignore-db 参数 跨库问题
- 关于IntelliJ IDEA的workspace.xml在git 中无法忽略Ignore的解决方案
- 关于IntelliJ IDEA的workspace.xml在git 中无法忽略Ignore的解决方案
- 一个容易忽略的问题
- [c++]容易忽略的问题
- 容易忽略的Tomcat安全问题
- 整合struts2,jquery,json。采用jquery ajax,从struts2 action返回json类型数据
- C#字符串处理
- C语言中的volatile
- C程序函数注释格式
- Android各版本API变更概要
- 关于iconv容易忽略的参数IGNORE
- 高级字符设备驱动-阻塞型字符设备驱动笔记
- ExtJS Grid的两个格式处理方法
- VB+ADO+Access如何修改数据
- QT入门笔记之Hello World
- java体系结构
- 敲击最多的键和编程语言语法
- /etc/inittab文件的字段及其说明
- VC增加windows消息处理方法