From: mtrojan at transline dot de
Operating system: Windows XP
PHP version: 5.2.6
PHP Bug Type: mbstring related
Bug description: mb_detect_encoding and mb_check_encoding results are dissonant
Description:
------------
mb_detect_encoding does not seem to recognize UTF-16 encoded files
properly. Even if it is assured by using mb_check_encoding that a file is
truly UTF-16LE, mb_detect_encoding does not detect the same file as UTF-16
and is returning ISO-8859-1 instead. Activating/deactivating strict mode
has no influence on the result.
Reproduce code:
---------------
$content = file_get_contents($src_path);
$encodings = array('UTF-16', 'UTF-16LE', 'UTF-16BE', 'UTF-8', 'UNICODE',
'ISO-8859-1');
$enc = mb_detect_encoding($content, $encodings);
print "encoding: $enc\n";
print 'checked: ' . intval(mb_check_encoding($content, 'UTF-16LE'));
Expected result:
----------------
encoding: UTF-16LE
checked: 1
Actual result:
--------------
encoding: ISO-8859-1
checked: 1
--
Edit bug report at http://bugs.php.net/?id=45993&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45993&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45993&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45993&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45993&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45993&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45993&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45993&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45993&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45993&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45993&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45993&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45993&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45993&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45993&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45993&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45993&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45993&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45993&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45993&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45993&r=mysqlcfg