Module converter

Source
Expand description

§Handle Converter

handle_converter provides functions to detect confusable Unicode characters in a given input string and return its canonical form.

Constants§

HANDLE_DELIMITER
Delimiter for handles

Statics§

CONFUSABLES
The mapping from homoglyph character to canonical Unicode character

Functions§

convert_to_canonical
Creates a new HandleConverter instance with a built confusables map. Converts a given string to its canonical form by stripping Unicode whitespace, replacing confusable characters, and stripping diacritical marks. The resulting string is converted to lowercase ASCII characters.
replace_confusables
Replaces any characters in the input string that are confusable with a different character.
split_display_name
Splits the given display name into its base handle and handle suffix.
strip_diacriticals
This function removes diacritical marks from the input string and returns a new String without them.
strip_unicode_whitespace
Strips any Unicode whitespace characters from the provided string and returns the resulting string.
trim_and_collapse_whitespace
Trims whitespace from the head and tail and collapses all other whitespace to just a single space