|
@@ 7080-7085 (lines=6) @@
|
| 7077 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 7078 |
|
$buf .= $c1 . $c2; |
| 7079 |
|
$i++; |
| 7080 |
|
} else { // not valid UTF8 - convert it |
| 7081 |
|
$cc1tmp = ord($c1) / 64; |
| 7082 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 7083 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 7084 |
|
$buf .= $cc1 . $cc2; |
| 7085 |
|
} |
| 7086 |
|
|
| 7087 |
|
} elseif ($c1 >= "\xE0" && $c1 <= "\xEF") { // looks like 3 bytes UTF8 |
| 7088 |
|
|
|
@@ 7095-7100 (lines=6) @@
|
| 7092 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 7093 |
|
$buf .= $c1 . $c2 . $c3; |
| 7094 |
|
$i += 2; |
| 7095 |
|
} else { // not valid UTF8 - convert it |
| 7096 |
|
$cc1tmp = ord($c1) / 64; |
| 7097 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 7098 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 7099 |
|
$buf .= $cc1 . $cc2; |
| 7100 |
|
} |
| 7101 |
|
|
| 7102 |
|
} elseif ($c1 >= "\xF0" && $c1 <= "\xF7") { // looks like 4 bytes UTF8 |
| 7103 |
|
|
|
@@ 7111-7116 (lines=6) @@
|
| 7108 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 7109 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
| 7110 |
|
$i += 3; |
| 7111 |
|
} else { // not valid UTF8 - convert it |
| 7112 |
|
$cc1tmp = ord($c1) / 64; |
| 7113 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 7114 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 7115 |
|
$buf .= $cc1 . $cc2; |
| 7116 |
|
} |
| 7117 |
|
|
| 7118 |
|
} else { // doesn't look like UTF8, but should be converted |
| 7119 |
|
$cc1tmp = ord($c1) / 64; |
|
@@ 7118-7123 (lines=6) @@
|
| 7115 |
|
$buf .= $cc1 . $cc2; |
| 7116 |
|
} |
| 7117 |
|
|
| 7118 |
|
} else { // doesn't look like UTF8, but should be converted |
| 7119 |
|
$cc1tmp = ord($c1) / 64; |
| 7120 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 7121 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 7122 |
|
$buf .= $cc1 . $cc2; |
| 7123 |
|
} |
| 7124 |
|
|
| 7125 |
|
} elseif (($c1 & "\xC0") === "\x80") { // needs conversion |
| 7126 |
|
|
|
@@ 7130-7134 (lines=5) @@
|
| 7127 |
|
$ordC1 = ord($c1); |
| 7128 |
|
if (isset(self::$WIN1252_TO_UTF8[$ordC1])) { // found in Windows-1252 special cases |
| 7129 |
|
$buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 7130 |
|
} else { |
| 7131 |
|
$cc1 = self::chr_and_parse_int($ordC1 / 64) | "\xC0"; |
| 7132 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 7133 |
|
$buf .= $cc1 . $cc2; |
| 7134 |
|
} |
| 7135 |
|
|
| 7136 |
|
} else { // it doesn't need conversion |
| 7137 |
|
$buf .= $c1; |