php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32062 mbstring fails to match encoding with some locale settings
Submitted: 2005-02-22 06:55 UTC Modified: 2006-02-17 00:23 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: moriyoshi@php.net Assigned: hirokawa (profile)
Status: Not a bug Package: mbstring related
PHP Version: 5CVS, 4CVS (2005-02-22) OS: *
Private report: No CVE-ID: None
 [2005-02-22 06:55 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-22 15:25 UTC] iliaa@php.net
tr_TR == Turkish, and ISO-8859-1 is not a valid character set of that locale, no?
 [2005-02-22 16:17 UTC] 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-12-21 23:24 UTC] sniper@php.net
Rui, check this too if you don't mind. :)
 [2005-12-23 15:43 UTC] hirokawa@php.net
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.



 [2005-12-31 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-02-17 00:23 UTC] hirokawa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 07:01:27 2024 UTC