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