| @@ 5529-5540 (lines=12) @@ | ||
| 5526 | { |
|
| 5527 | $value = ord($string[$position]); |
|
| 5528 | // Check that the byte is valid, then add it to the character: |
|
| 5529 | if (($value & 0xC0) === 0x80) |
|
| 5530 | { |
|
| 5531 | $character |= ($value & 0x3F) << (--$remaining * 6); |
|
| 5532 | } |
|
| 5533 | // If it is invalid, count the sequence as invalid and reprocess the current byte: |
|
| 5534 | else |
|
| 5535 | { |
|
| 5536 | $valid = false; |
|
| 5537 | $position--; |
|
| 5538 | ||
| 5539 | break; |
|
| 5540 | } |
|
| 5541 | } |
|
| 5542 | } |
|
| 5543 | else |
|
| @@ 5649-5660 (lines=12) @@ | ||
| 5646 | else |
|
| 5647 | { |
|
| 5648 | // Check that the byte is valid, then add it to the character: |
|
| 5649 | if (($value & 0xC0) === 0x80) |
|
| 5650 | { |
|
| 5651 | $remaining--; |
|
| 5652 | $character |= ($value & 0x3F) << ($remaining * 6); |
|
| 5653 | } |
|
| 5654 | // If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence: |
|
| 5655 | else |
|
| 5656 | { |
|
| 5657 | $valid = false; |
|
| 5658 | $remaining = 0; |
|
| 5659 | $i--; |
|
| 5660 | } |
|
| 5661 | } |
|
| 5662 | // If we've reached the end of the current byte sequence, append it to Unicode::$data |
|
| 5663 | if (!$remaining) |
|