|
@@ 5469-5480 (lines=12) @@
|
| 5466 |
|
$buf .= $cc1 . $cc2; |
| 5467 |
|
} |
| 5468 |
|
|
| 5469 |
|
} elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
| 5470 |
|
|
| 5471 |
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 5472 |
|
$buf .= $c1 . $c2 . $c3; |
| 5473 |
|
$i += 2; |
| 5474 |
|
} else { // not valid UTF8 - convert it |
| 5475 |
|
$cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 5476 |
|
$cc2 = ($c1 & "\x3f") | "\x80"; |
| 5477 |
|
$buf .= $cc1 . $cc2; |
| 5478 |
|
} |
| 5479 |
|
|
| 5480 |
|
} elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
| 5481 |
|
|
| 5482 |
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 5483 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
|
@@ 5482-5489 (lines=8) @@
|
| 5479 |
|
|
| 5480 |
|
} elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
| 5481 |
|
|
| 5482 |
|
if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 5483 |
|
$buf .= $c1 . $c2 . $c3 . $c4; |
| 5484 |
|
$i += 3; |
| 5485 |
|
} else { // not valid UTF8 - convert it |
| 5486 |
|
$cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 5487 |
|
$cc2 = ($c1 & "\x3f") | "\x80"; |
| 5488 |
|
$buf .= $cc1 . $cc2; |
| 5489 |
|
} |
| 5490 |
|
|
| 5491 |
|
} else { // doesn't look like UTF8, but should be converted |
| 5492 |
|
$cc1 = (chr(ord($c1) / 64) | "\xc0"); |