|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-08-16 19:14 UTC] martin at herndl dot org
Description: ------------ mb_detect_encoding with ommited encodings (= null as argument => fallback to default detect order) behaves different on 8.1.0beta2 and fails to detect UTF-8 in some cases with out-of-the-box settings. I noticed this via the `ApplicationTest::testRenderExceptionWithDoubleWidthCharacters` test from Symfony in https://github.com/symfony/symfony/issues/41552 that broke because it converted UTF-8 to UTF-8 again. Test script: --------------- <?php var_dump(mb_detect_order()); var_dump(mb_detect_encoding('コマンドの実行中にエラーが発生しました。', null, true)); var_dump(mb_detect_encoding('コマンドの実行中にエラーが発生しました', null, true)); Expected result: ---------------- array(2) { [0]=> string(5) "ASCII" [1]=> string(5) "UTF-8" } string(5) "UTF-8" string(5) "UTF-8" Actual result: -------------- array(2) { [0]=> string(5) "ASCII" [1]=> string(5) "UTF-8" } string(5) "ASCII" string(5) "UTF-8" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 21:00:01 2025 UTC |
A simpler example that I just found: Test script: --------------- <?php var_dump(mb_detect_encoding(' § ', null, true)); Expected result: ---------------- string(5) "UTF-8" Actual result: -------------- string(5) "ASCII"