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