This article was also published in HTTPS://GITHUB.COM/ZHANGYACHEN/ZHANGYACHEN.GITHUB.IO/ISSUES/57
User input: Intel? Cool core? i7 processor prowess
Case1
$valueiconv("UTF-8","GBK//TRANSLIT",$value);
Results:
英特尔(R) 酷睿(TM) i7处理器大显身手
Case2
$valueiconv("UTF-8","GBK//IGNORE",$value);
Results:
英特尔 酷睿 i7处理器大显身手
Case3
$valueiconv("UTF-8","GBK",$value);
Results:
英特尔
Case4
mb_convert_encoding($value,"GBK","UTF-8");
Results:
英特尔? 酷睿? i7处理器大显身手
Analysis
iconv ( string $in_charset , string $out_charset , string $str )
- If you add a string//translit after Out_charset, the transliteration (transliteration) feature is enabled. This means that when a character cannot be represented by the target character set, it can be approximated by one or more similar characters.
- If you add a string//ignore, characters that cannot be expressed in the target character set are silently discarded.
- If no string is added after the out_charset, it is truncated starting with the first unrecognized character and generates a e_notice. So the content behind is discarded.
PHP iconv function parameter differences