#48210 [Opn]: mb_detect_encoding fails to detect right charset

From: Date: Sat, 09 May 2009 17:58:09 +0000
Subject: #48210 [Opn]: mb_detect_encoding fails to detect right charset
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-137040@lists.php.net to get a copy of this message
ID: 48210 User updated by: nilon at kartio dot org Reported By: nilon at kartio dot org Status: Open Bug Type: *Unicode Issues Operating System: Debian Lenny PHP Version: 5.2.9 New Comment: With strict option result is: string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(5) "UTF-8" Still last one should return false. Previous Comments: ------------------------------------------------------------------------ [2009-05-09 17:53:42] nilon at kartio dot org Description: ------------ mb_detect_encoding detects latin1 'ä' as UTF-8 when it clearly isn't multibyte character. Reproduce code: --------------- <?php var_dump(mb_detect_encoding("\xe4", 'UTF-8, ISO-8859-1')); var_dump(mb_detect_encoding("\xe4", 'ISO-8859-1, UTF-8')); var_dump(mb_detect_encoding("\xe4", 'ISO-8859-1')); var_dump(mb_detect_encoding("\xe4", 'UTF-8')); ?> Expected result: ---------------- string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(10) "ISO-8859-1" bool "false" Actual result: -------------- string(5) "UTF-8" string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(5) "UTF-8" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48210&edit=1

« previous php.bugs (#137040) next »