|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65110 mb_convert_encoding's auto is not work, when using mbstring.language=English
Submitted: 2013-06-24 12:44 UTC Modified: 2017-07-28 19:56 UTC
Avg. Score:4.4 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:1 (16.7%)
From: f133715 at rmqkr dot net Assigned:
Status: Open Package: mbstring related
PHP Version: 5.4.16 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-06-24 12:44 UTC] f133715 at rmqkr dot net
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:
$out_strs = mb_convert_encoding($out_strs, "UTF-8", "ASCII,JIS,UTF-8,EUC-

$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:
Why should I change mbstring.language = English to Japs?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-24 17:11 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: moriyoshi
 [2017-07-28 19:56 UTC]
-Status: Assigned +Status: Open -Type: Bug +Type: Documentation Problem -Assigned To: moriyoshi +Assigned To:
 [2017-07-28 19:56 UTC]
Quoting from

> 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

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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 21:01:27 2024 UTC