We're updating the issue view to help you get more done. 

SpoofChecker bug

Description

In IdentifierInfo, there is the following bug:

1 2 3 4 int cp; for (int i = 0; i < identifier.length(); i += Character.charCount(i)) { cp = Character.codePointAt(identifier, i); ...

It should be:

1 2 3 4 int cp; for (int i = 0; i < identifier.length(); i += Character.charCount(cp)) { cp = Character.codePointAt(identifier, i); ...

This will cause the spurious introduction of UScript.Unknown values. In most cases this won't affect the final results of using the SpoofChecker, but in some it will.


This part was moved to #11644

BTW, the pattern we (and Java) use for iterating through code points in a string is quite fragile. I'd recommend considering using the code that is in CLDR. The above lines would be:

for (int cp : With.codePointArray(identifier)) {
...

As it turns out, it is also faster for any case where the iteration is not aborted, to have an optimized method that fills an array with the code points.

With.java

public static int[] codePointArray(CharSequence source) {
return CharSequences.codePoints(source);
}

Status

Assignee

Andy Heninger

Reporter

Mark Davis

Labels

Components

Fix versions

Priority

major