#51060 [Opn->Csd]: mb_check_encoding fails on correctly encoded iso-2022-jp string

From: Date: Mon, 22 Feb 2010 06:18:44 +0000
Subject: #51060 [Opn->Csd]: mb_check_encoding fails on correctly encoded iso-2022-jp string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-147939@lists.php.net to get a copy of this message
ID: 51060 Updated by: moriyoshi@php.net Reported By: areid at lumerical dot com -Status: Open +Status: Closed Bug Type: mbstring related Operating System: Linux (RHEL5) PHP Version: 5.2.12 New Comment: Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Previous Comments: ------------------------------------------------------------------------ [2010-02-16 20:22:45] areid at lumerical dot com Description: ------------ I have found that mb_check_encoding returns false when I pass it a string that I think is correctly encoded. It occurs when the string contains Roman characters encoded in the JIS X 0201-1976 character set. I cehcked that according to RFC 1468 this encoding is valid. Furthermore, mb_convert_encoding is able to decode this string. Reproduce code: --------------- $encoded = "\x1b(JTEST"; if(!mb_check_encoding($encoded,'ISO-2022-JP')) echo "check encoding failed\n"; echo mb_convert_encoding($encoded,'UTF-8','ISO-2022-JP')."\n"; Expected result: ---------------- I expect only the word "TEST" to be printed Actual result: -------------- "check encoding failed" is printed indicating that mb_check_encoding returned FALSE. "TEST" is also printed, showing that mb_chonvert_encoding successfully decoded the string. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=51060&edit=1

« previous php.bugs (#147939) next »