[php-src] Issue #11908: PHP > 8.1 fails to detect Māori macrons
| From: | RoSk0 | Date: | Tue, 08 Aug 2023 08:13:53 +0000 |
| Subject: | [php-src] Issue #11908: PHP > 8.1 fails to detect Māori macrons | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245129@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11908
Author: RoSk0
### Description
The following code:
```php
<?php
$str = 'Total%20M%C4%81ori%2C31.5%2C33.3%2C31.8%2C33%2C36.4%2C33.2%2C33.2';
$rawstr = rawurldecode($str);
var_dump(
mb_detect_encoding($rawstr, ['UTF-8', 'ISO-8859-1',
'WINDOWS-1251']),
mb_detect_encoding($rawstr, ['ISO-8859-1', 'WINDOWS-1251',
'UTF-8']),
mb_detect_encoding($rawstr, ['WINDOWS-1251', 'UTF-8',
'ISO-8859-1']),
mb_check_encoding($rawstr, 'ISO-8859-1'),
mb_check_encoding($rawstr, 'UTF-8'),
mb_check_encoding($rawstr, 'WINDOWS-1251'),
);
```
https://3v4l.org/jYDqY
Resulted in this output:
```
string(12) "Windows-1251"
string(12) "Windows-1251"
string(12) "Windows-1251"
bool(true)
bool(true)
bool(true)
```
But I expected this output instead:
```
string(5) "UTF-8"
string(5) "UTF-8"
string(5) "UTF-8"
bool(false)
bool(true)
bool(false)
```
## Related issues
- https://github.com/php/php-src/issues/10192
- https://github.com/php/php-src/issues/7871
- https://github.com/php/php-src/pull/8439
- https://github.com/php/php-src/issues/10481
- https://github.com/php/php-src/issues/8279
### PHP Version
PHP 8.1.22
### Operating System
_No response_