`\xFF` is a valid character of CP-1251.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.1.17
+- Mbstring:
+ . Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
29 Mar 2018, PHP 7.1.16
/* all of this is so ugly now! */
static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter)
{
- if (c >= 0x80 && c < 0xff)
+ if (c >= 0x80 && c <= 0xff)
filter->flag = 0;
else
filter->flag = 1; /* not it */
--- /dev/null
+--TEST--\r
+Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)\r
+--SKIPIF--\r
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>\r
+--FILE--\r
+<?php\r
+var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'\r
+var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'\r
+?>\r
+--EXPECT--\r
+string(12) "Windows-1251"\r
+string(12) "Windows-1251"\r
+\r