|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-12-21 19:14 UTC] ab@php.net
-Status: Open
+Status: Not a bug
[2015-12-21 19:14 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
Description: ------------ mb_detect_encoding doesn't detect string with Windows-1252 ( cp1252 ) encoding. The function is supposed to return the first compatible encoding within the provided encoding list as second param. Even with an ASCII string like 'aaa', it refuse the Windows-1252 encoding. Test script: --------------- <?php $enc = 'Windows-1252'; if (!in_array($enc, mb_list_encodings())) { die($enc.' not supported'); } $val = '100 '. 0x80; // € sign in cp1252 echo mb_detect_encoding($val, $enc.',ISO-8859-1', true).PHP_EOL; $val = 'aaa'; echo mb_detect_encoding($val, $enc.',ISO-8859-1', true).PHP_EOL; Expected result: ---------------- Windows-1252 Windows-1252 Actual result: -------------- ISO-8859-1 ISO-8859-1