#47876 [NEW]: Wrong mb_detect_encoding() with string "chráany"
| From: | FrancS at seznam dot cz | Date: | Thu, 02 Apr 2009 10:08:08 +0000 |
| Subject: | #47876 [NEW]: Wrong mb_detect_encoding() with string "chráany" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-135487@lists.php.net to get a copy of this message | ||
From: FrancS at seznam dot cz
Operating system: Windows XP
PHP version: 5.2.9
PHP Bug Type: mbstring related
Bug description: Wrong mb_detect_encoding() with string "chráany"
Description:
------------
Hi,
today I discover a problem with mb function mb_detect_encoding().
I have a string "chráany" in czech language. It seems that this function
everytime return UTF-8 encoding, even if I load the text from a file with
encoding "windows-1250" or "ISO-8859-2".
Reproduce code:
---------------
// test.txt is text file with charset "windows-1250" or "ISO-8859-2"
$string = file_get_contents('test.txt');
var_dump(mb_detect_encoding($string, mb_list_encodings(), true));
Expected result:
----------------
SJIS
Actual result:
--------------
utf-8
--
Edit bug report at http://bugs.php.net/?id=47876&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47876&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47876&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47876&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47876&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47876&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47876&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47876&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47876&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47876&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47876&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47876&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47876&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47876&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47876&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47876&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47876&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47876&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47876&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47876&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47876&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47876&r=mysqlcfg