|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-04-20 09:21 UTC] teracci2002 at yahoo dot co dot jp
Description:
------------
mb_check_encoding returns true when specific invalid EUC-JP / Shift_JIS / UTF-8 char sequence supplied.
Reproduce code:
---------------
//(1)
var_dump(mb_check_encoding("\x00\xA1", "EUC-JP"));
//(2)
var_dump(mb_check_encoding("\x00\x81", "Shift_JIS"));
//(3)
var_dump(mb_check_encoding("\x00\xE3", "UTF-8"));
Expected result:
----------------
//(1)
bool(false)
//(2)
bool(false)
//(3)
bool(false)
Actual result:
--------------
//(1)
bool(true)
//(2)
bool(true)
//(3)
bool(true)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
> 0x00+0xa1 is valid byte sequence in Shift_JIS sequence. I know it. But 0x00+0x81 is invalid sequence in Shift_JIS. Then, why below statement returns "bool(true)" ? var_dump(mb_check_encoding("\x00\x81", "Shift_JIS")); Read bug report again, please.I guess the problem is not only in the document. var_dump(mb_check_encoding("\x00\xE3","UTF-8")); => bool(true) may be checking validity of "byte streams" var_dump(mb_check_encoding("\xE3", "UTF-8")); => bool(false) may be checking validity of "string" # I hope that this function checks validity of "string", not "byte streams" (but this is just my opinion).