#32062 [Asn->Fbk]: mbstring fails to match encoding with some locale settings

From: Date: Fri, 23 Dec 2005 14:43:28 +0000
Subject: #32062 [Asn->Fbk]: mbstring fails to match encoding with some locale settings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90942@lists.php.net to get a copy of this message
ID: 32062 Updated by: hirokawa@php.net Reported By: moriyoshi@php.net -Status: Assigned +Status: Feedback Bug Type: mbstring related Operating System: * PHP Version: 5CVS, 4CVS (2005-02-22) Assigned To: hirokawa New Comment: mbstring (libmbfl) uses strcasecmp() which depends on the locale. If the specified locale is not supported in the system, encoding match fails. It is not the problem of mbstring, but it is the problem of system setting. Previous Comments: ------------------------------------------------------------------------ [2005-12-21 23:24:01] sniper@php.net Rui, check this too if you don't mind. :) ------------------------------------------------------------------------ [2005-02-22 16:17:51] moriyoshi@php.net Right, there were typos. The reproduce code should've been <?php setlocale(LC_CTYPE, 'de_DE.ISO-8859-1'); var_dump(mb_convert_encoding('a', 'utf-8', 'iso-8859 -1')); var_dump(mb_convert_encoding('a', 'UTF-8', 'ISO-8859 -1')); setlocale(LC_CTYPE, 'tr_TR.ISO-8859-9'); var_dump(mb_convert_encoding('a', 'utf-8', 'iso-8859 -1')); var_dump(mb_convert_encoding('a', 'UTF-8', 'ISO-8859 -1')); ?> ------------------------------------------------------------------------ [2005-02-22 15:25:03] iliaa@php.net tr_TR == Turkish, and ISO-8859-1 is not a valid character set of that locale, no? ------------------------------------------------------------------------ [2005-02-22 06:55:52] moriyoshi@php.net Description: ------------ mbstring fails to match encoding name against any one of the supported encodings with some locale settings. Irrelevant to bug #29955. Reproduce code: --------------- <?php setlocale(LC_CTYPE, 'tr_TR.ISO-8859-1'); var_dump(mb_convert_encoding('abc', 'utf-8', 'iso-8859-1')); var_dump(mb_convert_encoding('abc', 'UTF-8', 'ISO-8859-1')); setlocale(LC_CTYPE, 'tr_TR.ISO-8859-9'); var_dump(mb_convert_encoding('abc', 'utf-8', 'iso-8859-1')); var_dump(mb_convert_encoding('abc', 'UTF-8', 'ISO-8859-1')); ?> Expected result: ---------------- string(1) "a" string(1) "a" string(1) "a" string(1) "a" Actual result: -------------- string(1) "a" string(1) "a" Warning: mb_convert_encoding(): Illegal character encoding specified in %s on line %d string(1) "a" string(1) "a" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32062&edit=1

« previous php.bugs (#90942) next »