#unicode-normalization #unicode #normalization #apple #handle #hfs

hfs_nfd

Handle Apple's unique NFD-like Unicode normalization, which is used in HFS+, in Rust

5 releases (3 stable)

2.0.0 Aug 28, 2021
1.1.0 Sep 22, 2020
1.0.0 Aug 11, 2020
0.1.1 Aug 10, 2020
0.1.0 Aug 10, 2020

#1020 in Text processing

46 downloads per month
Used in 2 crates (via zifu_core)

MIT license

270KB
3K SLoC

Apple HFS+ NFD-like Unicode Normalization Library for Rust

CI (master) CI (Release) hfs_nfd at crates.io hfs_nfd at docs.rs

HFS+, the file system formerly used in Apple macOS, uses a unique Unicode normalization similar to NFD.

This library composes or decomposes Unicode code points according to the normalization. e.g.

  • Université[U+00E9] de Paris (Common) ⇔ Université[U+0065 U+0301] de Paris (HFS+)
  • アップ[U+30D7]ル (Common) ⇔ アップ[U+30D5 U+309A]ル (HFS+)

How to use

Add this library hfs_nfd to your Cargo.toml.

[dependencies]
another_library1 = "<version>"
another_library2 = "<version>"
# *snip*
hfs_nfd = "2.0.0" # <= Here
# *snip*

Then, use these functions:

use hfs_nfd::{compose_from_hfs_nfd,decompose_into_hfs_nfd};

assert_eq!(decompose_into_hfs_nfd("Universit\u{00E9}"), "Universite\u{0301}".to_string());
assert_eq!(compose_from_hfs_nfd("アッフ\u{309A}"), "アッ\{30D7}ル".to_string());

Dependencies

~0.4–1MB
~22K SLoC