Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It turns out that this returns true not just if the byte is a leading byte, but also if the byte never appears in any valid UTF-8 sequence. Furthermore, this is OK based on how we're using the function. It's only used in two places. The first place only ever calls it with valid UTF-8 bytes, since it's backing up in the input in a region that's guaranteed to be valid UTF-8. The second place (decoding a codepoint in reverse) is OK treating invalid UTF-8 bytes as leading bytes, since they can never be a valid prefix anyway. After backing up, the forward decode function will handle the case correctly. Since the behavior is OK, we change the name of the function to indicate its true behavior and add a comment clarifying it. Fixes #54
- Loading branch information