|
@@ 76-78 (lines=3) @@
|
| 73 |
|
// wibble the boundary |
| 74 |
|
if (0x80 != (0xC0 & ord($text[$i + $max_chunk_size]))) { |
| 75 |
|
$chunk_size = $max_chunk_size; |
| 76 |
|
} elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 1]))) { |
| 77 |
|
$chunk_size = $max_chunk_size - 1; |
| 78 |
|
} elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 2]))) { |
| 79 |
|
$chunk_size = $max_chunk_size - 2; |
| 80 |
|
} elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 3]))) { |
| 81 |
|
$chunk_size = $max_chunk_size - 3; |
|
@@ 80-82 (lines=3) @@
|
| 77 |
|
$chunk_size = $max_chunk_size - 1; |
| 78 |
|
} elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 2]))) { |
| 79 |
|
$chunk_size = $max_chunk_size - 2; |
| 80 |
|
} elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 3]))) { |
| 81 |
|
$chunk_size = $max_chunk_size - 3; |
| 82 |
|
} else { |
| 83 |
|
return false; // rather confusing UTF-8... |
| 84 |
|
} |
| 85 |
|
$chunk = substr($text, $i, $chunk_size); // substr doesn't mind overlong lengths |