#text #unicode #normalization #decomposition #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

#191 in Text processing

Download history 1328/week @ 2021-08-13 2167/week @ 2021-08-20 1704/week @ 2021-08-27 1694/week @ 2021-09-03 1571/week @ 2021-09-10 1593/week @ 2021-09-17 1382/week @ 2021-09-24 1340/week @ 2021-10-01 1648/week @ 2021-10-08 1277/week @ 2021-10-15 1498/week @ 2021-10-22 1692/week @ 2021-10-29 1863/week @ 2021-11-05 1878/week @ 2021-11-12 1694/week @ 2021-11-19 2027/week @ 2021-11-26

7,877 downloads per month
Used in 8 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