php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51060 mb_check_encoding fails on correctly encoded iso-2022-jp string
Submitted: 2010-02-16 20:22 UTC Modified: 2010-02-22 06:18 UTC
From: areid at lumerical dot com Assigned:
Status: Closed Package: mbstring related
PHP Version: 5.2.12 OS: Linux (RHEL5)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: areid at lumerical dot com
New email:
PHP Version: OS:

 

 [2010-02-16 20:22 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-22 06:18 UTC] moriyoshi@php.net
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


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 22:01:36 2025 UTC