Crate unicode_skeleton [] [src]

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.