iconv命令可以将一种已知的字符集文件转换成另一种已知的字符集文件。
iconv -- Convert string to requested character encoding
string iconv ( string in_charset, string out_charset, string str )
Performs a character set conversion on the string str from in_charset to out_charset. Returns the converted string or FALSE on failure.
If you append the string //TRANSLIT to out_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.
例子 iconv() example:
<?php
echo iconv("UTF-8", "GB2312", "This is a test.");//把UTF-8编码的“This is a test.”转换成GB2312编码
?>
iconv
最新推荐文章于 2023-02-24 17:30:56 发布