Crate unicode_skeleton

Source
Expand description

Transforms a unicode string by replacing unusual characters with similar-looking common characters, as specified by the Unicode Standard Annex #39. For example, β€œβ„π“Šπ“ˆπ“‰β€ will be transformed to β€œRust”. This simplified string is called the β€œskeleton”.

use unicode_skeleton::UnicodeSkeleton;

"β„π“Šπ“ˆπ“‰".skeleton_chars().collect::<String>() // "Rust"

Strings are considered β€œconfusable” if they have the same skeleton. For example, β€œβ„π“Šπ“ˆπ“‰β€ and β€œRust” are confusable.

use unicode_skeleton::confusable;

confusable("β„π“Šπ“ˆπ“‰", "Rust") // true

The translation to skeletons is based on Unicode Security Mechanisms for UTR #39 version 10.0.0.

StructsΒ§

SkeletonChars
An iterator over the characters of the skeleton of a unicode string. This is retrieved via the UnicodeSkeleton trait.

TraitsΒ§

UnicodeSkeleton
Method for retrieving a SkeletonChars from a str or other char iterator.

FunctionsΒ§

confusable
Test if two strings have the same β€œskeleton”, and thus could be visually confused for each another.