| @@ 479-487 (lines=9) @@ | ||
| 476 | $value = ord($string[$position]); |
|
| 477 | ||
| 478 | // Check that the byte is valid, then add it to the character: |
|
| 479 | if (($value & 0xC0) === 0x80) { |
|
| 480 | $character |= ($value & 0x3F) << (--$remaining * 6); |
|
| 481 | } |
|
| 482 | // If it is invalid, count the sequence as invalid and reprocess the current byte: |
|
| 483 | else { |
|
| 484 | $valid = false; |
|
| 485 | $position--; |
|
| 486 | break; |
|
| 487 | } |
|
| 488 | } |
|
| 489 | } |
|
| 490 | else { |
|
| @@ 602-611 (lines=10) @@ | ||
| 599 | // Continuation byte: |
|
| 600 | else { |
|
| 601 | // Check that the byte is valid, then add it to the character: |
|
| 602 | if (($value & 0xC0) === 0x80) { |
|
| 603 | $remaining--; |
|
| 604 | $character |= ($value & 0x3F) << ($remaining * 6); |
|
| 605 | } |
|
| 606 | // If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence: |
|
| 607 | else { |
|
| 608 | $valid = false; |
|
| 609 | $remaining = 0; |
|
| 610 | $i--; |
|
| 611 | } |
|
| 612 | } |
|
| 613 | ||
| 614 | // If we've reached the end of the current byte sequence, append it to Unicode::$data |
|