-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AsciiBuffer.indexOf
returns incorrect result for 2-bytes characters (…
…#2352) * `AsciiBuffer.indexOf` returns incorrect result for 2-bytes characters Motivation: `AsciiBuffer.indexOf` casts `char` to `byte` by dropping the higher 8 bits. As the result, it may return an index of an ascii character that has the same lower 8 bits. Modifications: - Check character length and return `-1` if it's 2-bytes character; Result: Correct result when users try to find an index of a 2-bytes character in `AsciiBuffer`. Consistency with other `CharSequence` implementations, like `String` and `StringBuilder`.
- Loading branch information
1 parent
5e5b746
commit f11310c
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters