if ($b1 <0x41||$this->posByte == 0) { // these bytes never appear in sequences, and the first byte is necessarily the start of a sequence
if ($b1 <0x41||$this->posByte === $this->errMark || $this->posByte == 0) { // these bytes never appear in sequences, a byte coming after an error is necessarily its own character, and the first byte is necessarily the start of a sequence
// the byte is a character
continue;
}
// go back a second byte
$b2 = ord(@$this->string[--$this->posByte]);
if ($b2 <0x81||$b2 ==0xFF){//thesebytesneverappearintheleadofasequence
if ($b2 <0x80){//thesebytesneverappearintheleadofasequence
// the first byte was a character
$this->posByte += 1;
continue;
} elseif ($b1 > 0x7F && $b2 > 0x7F) { // two non-ASCII bytes in a row with no error necessarily form a sequence
// the second byte is a charactrer
continue;
} else { // the second byte is part of a two-byte sequence, but it's unclear if it's the lead or trail byte
$start = $this->posByte + 2;
$pos = $this->posByte;
// go back bytes until a definite trail byte or start of string
while ($pos > 0) {
// go back bytes until an error mark, an ASCII byte, or start of string