#unicode-normalization #unicode #normalization #unicode-text #decomposition #unicode-characters #recomposition

unicode-normalization-alignments

This crate provides functions for normalization of Unicode strings, including Canonical and Compatible Decomposition and Recomposition, as described in Unicode Standard Annex #15

1 unstable release

Uses old Rust 2015

0.1.12 Dec 30, 2019

#802 in Text processing

Download history 38197/week @ 2024-07-22 34011/week @ 2024-07-29 33756/week @ 2024-08-05 32181/week @ 2024-08-12 34853/week @ 2024-08-19 36107/week @ 2024-08-26 34659/week @ 2024-09-02 38833/week @ 2024-09-09 39223/week @ 2024-09-16 40752/week @ 2024-09-23 43862/week @ 2024-09-30 42466/week @ 2024-10-07 48915/week @ 2024-10-14 53008/week @ 2024-10-21 46498/week @ 2024-10-28 45967/week @ 2024-11-04

196,106 downloads per month
Used in 126 crates (3 directly)

MIT/Apache

495KB
24K SLoC

unicode-normalization-alignments

Build Status Docs

This is a forked version of unicode-normalization wich provides alignment information during normalization.

Unicode character composition and decomposition utilities as described in Unicode Standard Annex #15.

This crate requires Rust 1.36+.

extern crate unicode_normalization_alignments;

use unicode_normalization_alignments::char::compose;
use unicode_normalization_alignments::UnicodeNormalization;

fn main() {
	assert_eq!(compose('A','\u{30a}'), Some('Å'));

	let s = "ÅΩ";
	let c = s.nfc().map(|(c, diff)| {
		match diff {
			0 => println!("Nothing changed here"),
			1 => println!("New character"),
			_ => println!("{} characters were removed", diff),
		}

		c
	}).collect::<String>();
	assert_eq!(c, "ÅΩ");
}

crates.io

You can use this package in your project by adding the following to your Cargo.toml:

[dependencies]
unicode-normalization-alignments = "0.1.12"

Dependencies