Bug->Doc #65110 [Asn->Opn]: mb_convert_encoding's auto is not work, when using mbstring.language=English
| From: | nikic@php.net | Date: | Fri, 28 Jul 2017 19:56:10 +0000 |
| Subject: | Bug->Doc #65110 [Asn->Opn]: mb_convert_encoding's auto is not work, when using mbstring.language=English | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14871@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65110&edit=1
ID: 65110
Updated by: nikic@php.net
Reported by: f133715 at rmqkr dot net
Summary: mb_convert_encoding's auto is not work, when using
mbstring.language=English
-Status: Assigned
+Status: Open
-Type: Bug
+Type: Documentation Problem
Package: mbstring related
Operating System: Windows
PHP Version: 5.4.16
-Assigned To: moriyoshi
+Assigned To:
Block user comment: N
Private report: N
New Comment:
Quoting from http://php.net/manual/en/mbstring.supported-encodings.php:
> If "auto" is set, it is expanded to the list of encodings defined per the NLS. >
> For instance, if the NLS is set to Japanese, the value is assumed to be
> "ASCII,JIS,UTF-8,EUC-JP,SJIS".
The default detection order that "auto" expands to depends on the language. The list you
quoted is for Japanese. For English it only consists of ASCII and UTF-8.
It would be good if the documentation mentioned what the actual detection orders are for the
supported languages.
Previous Comments:
------------------------------------------------------------------------
[2013-06-24 12:44:21] f133715 at rmqkr dot net
Description:
------------
1. The version number of the PHP package or files you are using.
Latest PHP 5.4 for Windows
2. A short script that reproduces the problem
<test script>
Sometimes, it produce this error on log file:
Warning: mb_convert_encoding(): Unable to detect character encoding in XXX.php
on line XXX
It seems that 'auto' is not expanding to "ASCII,JIS,UTF-8,EUC-JP,SJIS".
This is a temporary fix for me:
[TYPE A]
$out_strs = mb_convert_encoding($out_strs, "UTF-8", "ASCII,JIS,UTF-8,EUC-
JP,SJIS");
or,
[TYPE B]
mb_language("Japanese");
$out_strs = mb_convert_encoding($out_strs, "UTF-8", "auto");
Test script:
---------------
I'm Englishman, so I'm added this in php.ini;
mbstring.language = English
mbstring.internal_encoding = UTF-8
And the source code is;
$out_strs = mb_convert_encoding($out_strs, "UTF-8", "auto");
Expected result:
----------------
auto SHOULD expand to ASCII,JIS,UTF-8,EUC-JP,SJIS.
Why should I change mbstring.language = English to Japs?
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65110&edit=1