|
@@ 6818-6823 (lines=6) @@
|
| 6815 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6816 |
|
$buf .= $c1 . $c2; |
| 6817 |
|
$i++; |
| 6818 |
|
} else { // not valid UTF8 - convert it |
| 6819 |
|
$cc1tmp = ord($c1) / 64; |
| 6820 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6821 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6822 |
|
$buf .= $cc1 . $cc2; |
| 6823 |
|
} |
| 6824 |
|
|
| 6825 |
|
} elseif ($c1 >= "\xE0" && $c1 <= "\xEF") { // looks like 3 bytes UTF8 |
| 6826 |
|
|
|
@@ 6833-6838 (lines=6) @@
|
| 6830 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6831 |
|
$buf .= $c1 . $c2 . $c3; |
| 6832 |
|
$i += 2; |
| 6833 |
|
} else { // not valid UTF8 - convert it |
| 6834 |
|
$cc1tmp = ord($c1) / 64; |
| 6835 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6836 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6837 |
|
$buf .= $cc1 . $cc2; |
| 6838 |
|
} |
| 6839 |
|
|
| 6840 |
|
} elseif ($c1 >= "\xF0" && $c1 <= "\xF7") { // looks like 4 bytes UTF8 |
| 6841 |
|
|
|
@@ 6849-6854 (lines=6) @@
|
| 6846 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6847 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
| 6848 |
|
$i += 3; |
| 6849 |
|
} else { // not valid UTF8 - convert it |
| 6850 |
|
$cc1tmp = ord($c1) / 64; |
| 6851 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6852 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6853 |
|
$buf .= $cc1 . $cc2; |
| 6854 |
|
} |
| 6855 |
|
|
| 6856 |
|
} else { // doesn't look like UTF8, but should be converted |
| 6857 |
|
$cc1tmp = ord($c1) / 64; |
|
@@ 6856-6861 (lines=6) @@
|
| 6853 |
|
$buf .= $cc1 . $cc2; |
| 6854 |
|
} |
| 6855 |
|
|
| 6856 |
|
} else { // doesn't look like UTF8, but should be converted |
| 6857 |
|
$cc1tmp = ord($c1) / 64; |
| 6858 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6859 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6860 |
|
$buf .= $cc1 . $cc2; |
| 6861 |
|
} |
| 6862 |
|
|
| 6863 |
|
} elseif (($c1 & "\xC0") === "\x80") { // needs conversion |
| 6864 |
|
|
|
@@ 6868-6872 (lines=5) @@
|
| 6865 |
|
$ordC1 = ord($c1); |
| 6866 |
|
if (isset(self::$WIN1252_TO_UTF8[$ordC1])) { // found in Windows-1252 special cases |
| 6867 |
|
$buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 6868 |
|
} else { |
| 6869 |
|
$cc1 = self::chr_and_parse_int($ordC1 / 64) | "\xC0"; |
| 6870 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6871 |
|
$buf .= $cc1 . $cc2; |
| 6872 |
|
} |
| 6873 |
|
|
| 6874 |
|
} else { // it doesn't need conversion |
| 6875 |
|
$buf .= $c1; |