Edit report at https://bugs.php.net/bug.php?id=61862&edit=1
ID: 61862 Updated by: ras...@php.net Reported by: jeniffer at tormail dot net Summary: mb_convert+htmlspecialchars returns nothing. -Status: Open +Status: Not a bug Type: Bug Package: mbstring related Operating System: Windows PHP Version: 5.4.1 Block user comment: N Private report: N New Comment: This was actually a bug in 5.3. 5.3, unless you specified differently would just assume iso-8859-1 and since every single-byte sequence is a valid char in 8859- 1, as long as it didn't see any bytes matching any special html chars, it would pass them right through in this case. So it wasn't actually escaping anything unless you got lucky and your charset was compatible with 8859-1 for those chars. This function now assumes UTF-8 if you don't specify differently and if it sees something that isn't UTF-8 it returns nothing. Since this is a security-related function, we can't just pass things through we don't understand. So in your case you want to pass 'SJIS' as the 3rd arg to htmlspecialchars() there, or you can pass '' and it will use the script encoding in zend_multibyte mode. Previous Comments: ------------------------------------------------------------------------ [2012-04-27 02:32:41] jeniffer at tormail dot net Description: ------------ In PHP 5.3.x, I can get expect result. But in PHP 5.4.x, this returns nothing. Why? Test script: --------------- <?php $converttext="ããã«ã¡ã¯ä¸ç"; $converttext=mb_convert_encoding($converttext,"SJIS","auto"); $converttext=htmlspecialchars($converttext,ENT_QUOTES); echo $converttext; ?> Expected result: ---------------- ããã«ã¡ã¯ä¸ç (in SJIS) Actual result: -------------- (nothing) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61862&edit=1