Bug #68119 [NEW]: mb_detect_encoding can not detect encoding rightly
| From: | zf at ancientrock dot org | Date: | Tue, 30 Sep 2014 00:55:13 +0000 |
| Subject: | Bug #68119 [NEW]: mb_detect_encoding can not detect encoding rightly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187761@lists.php.net to get a copy of this message | ||
From: zf at ancientrock dot org
Operating system: Linux
PHP version: master-Git-2014-09-30 (Git)
Package: mbstring related
Bug Type: Bug
Bug description:mb_detect_encoding can not detect encoding rightly
Description:
------------
mb_detect_encoding can not detect encoding rightly
$str1 = hex2bin('e58da0e6a5bc');
$str2 = hex2bin('d5bcc2a5');
we want to detect encoding to see what's it!
CP936? EUC-CN ? UTF-8?
Test script:
---------------
$str1 = hex2bin('e58da0e6a5bc');
$str2 = hex2bin('d5bcc2a5');
var_dump(mb_detect_encoding($str1, 'CP936', true));
var_dump(mb_detect_encoding($str1, 'EUC-CN', true));
var_dump(mb_detect_encoding($str1, 'UTF-8', true));
var_dump(mb_detect_encoding($str2, 'CP936', true));
var_dump(mb_detect_encoding($str2, 'EUC-CN', true));
var_dump(mb_detect_encoding($str2, 'UTF-8', true));
Expected result:
----------------
$str1 was UTF-8 encoding,
$str2 was CP936 encoding.
Actual result:
--------------
All detect return true
--
Edit bug report at https://bugs.php.net/bug.php?id=68119&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68119&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68119&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68119&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68119&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68119&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68119&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68119&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68119&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68119&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68119&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68119&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68119&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68119&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68119&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68119&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68119&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68119&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68119&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68119&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68119&r=mysqlcfg