public static class SpoofChecker.Builder
SpoofChecker Builder. To create a SpoofChecker, first instantiate a SpoofChecker.Builder, set the desired
checking options on the builder, then call the build() function to create a SpoofChecker instance.
Constructor: Create a default Unicode Spoof Checker Builder, configured to perform all checks except for
LOCALE_LIMIT and CHAR_LIMIT. Note that additional checks may be added in the future, resulting in the changes
to the default checking behavior.
Specify the source form of the spoof data Spoof Checker. The inputs correspond to the Unicode data
files confusables.txt and confusablesWholeScript.txt as described in Unicode UAX 39. The syntax of the source
data is as described in UAX 39 for these files, and the content of these files is acceptable input.
confusables - the Reader of confusable characters definitions, as found in file confusables.txt from
confusablesWholeScript - the Reader of whole script confusables definitions, as found in the file
xonfusablesWholeScript.txt from unicode.org.
Limit characters that are acceptable in identifiers being checked to those normally used with the languages
associated with the specified locales. Any previously specified list of locales is replaced by the new
A set of languages is determined from the locale(s), and from those a set of acceptable Unicode scripts is
determined. Characters from this set of scripts, along with characters from the "common" and "inherited"
Unicode Script categories will be permitted.
Supplying an empty string removes all restrictions; characters from any script will be allowed.
The CHAR_LIMIT test is automatically enabled for this SpoofChecker when calling this function with a
non-empty list of locales.
The Unicode Set of characters that will be allowed is accessible via the getAllowedChars() function.
setAllowedLocales() will replace any previously applied set of allowed characters.
Adjustments, such as additions or deletions of certain classes of characters, can be made to the result of
setAllowedLocales() by fetching the resulting set with getAllowedChars(), manipulating it with the Unicode
Set API, then resetting the spoof detectors limits with setAllowedChars()
locales - A Set of ULocales, from which the language and associated script are extracted. If the locales Set
is null, no restrictions will be placed on the allowed characters.
Limit the acceptable characters to those specified by a Unicode Set. Any previously specified character limit
is is replaced by the new settings. This includes limits on characters that were set with the
setAllowedLocales() function. Note that the RESTRICTED set is useful;
The CHAR_LIMIT test is automatically enabled for this SpoofChecker by this function.
chars - A Unicode Set containing the list of characters that are permitted. The incoming set is cloned by
this function, so there are no restrictions on modifying or deleting the UnicodeSet after calling
this function. Note that this clears the allowedLocales set.