#51060 [NEW]: mb_check_encoding fails on correctly encoded iso-2022-jp string
| From: | areid at lumerical dot com | Date: | Tue, 16 Feb 2010 20:22:45 +0000 |
| Subject: | #51060 [NEW]: mb_check_encoding fails on correctly encoded iso-2022-jp string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-147712@lists.php.net to get a copy of this message | ||
From: areid at lumerical dot com
Operating system: Linux (RHEL5)
PHP version: 5.2.12
PHP Bug Type: mbstring related
Bug description: mb_check_encoding fails on correctly encoded iso-2022-jp string
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 bug report at http://bugs.php.net/?id=51060&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51060&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51060&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51060&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51060&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51060&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51060&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51060&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51060&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51060&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51060&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51060&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51060&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51060&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51060&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51060&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51060&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51060&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51060&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51060&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51060&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51060&r=mysqlcfg