|
@@ 6925-6930 (lines=6) @@
|
| 6922 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6923 |
|
$buf .= $c1 . $c2; |
| 6924 |
|
$i++; |
| 6925 |
|
} else { // not valid UTF8 - convert it |
| 6926 |
|
$cc1tmp = ord($c1) / 64; |
| 6927 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6928 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6929 |
|
$buf .= $cc1 . $cc2; |
| 6930 |
|
} |
| 6931 |
|
|
| 6932 |
|
} elseif ($c1 >= "\xE0" && $c1 <= "\xEF") { // looks like 3 bytes UTF8 |
| 6933 |
|
|
|
@@ 6940-6945 (lines=6) @@
|
| 6937 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6938 |
|
$buf .= $c1 . $c2 . $c3; |
| 6939 |
|
$i += 2; |
| 6940 |
|
} else { // not valid UTF8 - convert it |
| 6941 |
|
$cc1tmp = ord($c1) / 64; |
| 6942 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6943 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6944 |
|
$buf .= $cc1 . $cc2; |
| 6945 |
|
} |
| 6946 |
|
|
| 6947 |
|
} elseif ($c1 >= "\xF0" && $c1 <= "\xF7") { // looks like 4 bytes UTF8 |
| 6948 |
|
|
|
@@ 6956-6961 (lines=6) @@
|
| 6953 |
|
if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6954 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
| 6955 |
|
$i += 3; |
| 6956 |
|
} else { // not valid UTF8 - convert it |
| 6957 |
|
$cc1tmp = ord($c1) / 64; |
| 6958 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6959 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6960 |
|
$buf .= $cc1 . $cc2; |
| 6961 |
|
} |
| 6962 |
|
|
| 6963 |
|
} else { // doesn't look like UTF8, but should be converted |
| 6964 |
|
$cc1tmp = ord($c1) / 64; |
|
@@ 6963-6968 (lines=6) @@
|
| 6960 |
|
$buf .= $cc1 . $cc2; |
| 6961 |
|
} |
| 6962 |
|
|
| 6963 |
|
} else { // doesn't look like UTF8, but should be converted |
| 6964 |
|
$cc1tmp = ord($c1) / 64; |
| 6965 |
|
$cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6966 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6967 |
|
$buf .= $cc1 . $cc2; |
| 6968 |
|
} |
| 6969 |
|
|
| 6970 |
|
} elseif (($c1 & "\xC0") === "\x80") { // needs conversion |
| 6971 |
|
|
|
@@ 6975-6979 (lines=5) @@
|
| 6972 |
|
$ordC1 = ord($c1); |
| 6973 |
|
if (isset(self::$WIN1252_TO_UTF8[$ordC1])) { // found in Windows-1252 special cases |
| 6974 |
|
$buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 6975 |
|
} else { |
| 6976 |
|
$cc1 = self::chr_and_parse_int($ordC1 / 64) | "\xC0"; |
| 6977 |
|
$cc2 = ($c1 & "\x3F") | "\x80"; |
| 6978 |
|
$buf .= $cc1 . $cc2; |
| 6979 |
|
} |
| 6980 |
|
|
| 6981 |
|
} else { // it doesn't need conversion |
| 6982 |
|
$buf .= $c1; |