Bug #81390 [Com]: mb_detect_encoding() regression
| From: | alec at alec dot pl | Date: | Thu, 26 Aug 2021 17:20:40 +0000 |
| Subject: | Bug #81390 [Com]: mb_detect_encoding() regression | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236095@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81390&edit=1
ID: 81390
Comment by: alec at alec dot pl
Reported by: alec at alec dot pl
Summary: mb_detect_encoding() regression
Status: Open
Type: Bug
Package: mbstring related
PHP Version: 8.1.0beta3
Block user comment: N
Private report: N
New Comment:
$test = 'test:test';
$encodings = array_diff(mb_list_encodings(), ['UUENCODE', 'wchar']);
echo mb_detect_encoding($test, $encodings, true);
returns HTML-ENTITIES, this makes no sense.
Previous Comments:
------------------------------------------------------------------------
[2021-08-26 17:10:34] alec at alec dot pl
Using $test = 'test:test' in the test script also will return UUENCODE. This is really
wrong.
------------------------------------------------------------------------
[2021-08-26 17:03:35] alec at alec dot pl
Description:
------------
The same code returns "ISO-8859-1" on PHP8.0 and "UUENCODE" on PHP8.1.0beta3.
Note: the text contains some ascii with two 0x0EB characters
Note: ISO-8859-1 is before UUENCODE in the mb_list_encodings() result.
Note: Even removing UUENCODE from the list does not make it to return expected ISO-8859-1
Test script:
---------------
$test = base64_decode('Q0hBUlNFVD13aW5kb3dzLTEyNTI6RG/rO0pvaG4=');
echo mb_detect_encoding($test, mb_list_encodings());
Expected result:
----------------
ISO-8859-1
Actual result:
--------------
UUENCODE
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81390&edit=1