|
@@ 5616-5627 (lines=12) @@
|
| 5613 |
|
$buf .= $cc1 . $cc2; |
| 5614 |
|
} |
| 5615 |
|
|
| 5616 |
|
} elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
| 5617 |
|
|
| 5618 |
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 5619 |
|
$buf .= $c1 . $c2 . $c3; |
| 5620 |
|
$i += 2; |
| 5621 |
|
} else { // not valid UTF8 - convert it |
| 5622 |
|
$cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 5623 |
|
$cc2 = ($c1 & "\x3f") | "\x80"; |
| 5624 |
|
$buf .= $cc1 . $cc2; |
| 5625 |
|
} |
| 5626 |
|
|
| 5627 |
|
} elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
| 5628 |
|
|
| 5629 |
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 5630 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
|
@@ 5629-5636 (lines=8) @@
|
| 5626 |
|
|
| 5627 |
|
} elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
| 5628 |
|
|
| 5629 |
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 5630 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
| 5631 |
|
$i += 3; |
| 5632 |
|
} else { // not valid UTF8 - convert it |
| 5633 |
|
$cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 5634 |
|
$cc2 = ($c1 & "\x3f") | "\x80"; |
| 5635 |
|
$buf .= $cc1 . $cc2; |
| 5636 |
|
} |
| 5637 |
|
|
| 5638 |
|
} else { // doesn't look like UTF8, but should be converted |
| 5639 |
|
$cc1 = (chr(ord($c1) / 64) | "\xc0"); |