| 1 | # unicode-normalization |
| 2 | |
| 3 | [](https://travis-ci.org/unicode-rs/unicode-normalization) |
| 4 | [](https://docs.rs/unicode-normalization/) |
| 5 | |
| 6 | Unicode character composition and decomposition utilities |
| 7 | as described in |
| 8 | [Unicode Standard Annex #15](http://www.unicode.org/reports/tr15/). |
| 9 | |
| 10 | This crate requires Rust 1.36+. |
| 11 | |
| 12 | ```rust |
| 13 | extern crate unicode_normalization; |
| 14 | |
| 15 | use unicode_normalization::char::compose; |
| 16 | use unicode_normalization::UnicodeNormalization; |
| 17 | |
| 18 | fn main() { |
| 19 | assert_eq!(compose('A','\u{30a}'), Some('Å')); |
| 20 | |
| 21 | let s = "ÅΩ"; |
| 22 | let c = s.nfc().collect::<String>(); |
| 23 | assert_eq!(c, "ÅΩ"); |
| 24 | } |
| 25 | ``` |
| 26 | |
| 27 | ## crates.io |
| 28 | |
| 29 | You can use this package in your project by adding the following |
| 30 | to your `Cargo.toml`: |
| 31 | |
| 32 | ```toml |
| 33 | [dependencies] |
| 34 | unicode-normalization = "0.1.25" |
| 35 | ``` |
| 36 | |
| 37 | ## `no_std` + `alloc` support |
| 38 | |
| 39 | This crate is completely `no_std` + `alloc` compatible. This can be enabled by disabling the `std` feature, i.e. specifying `default-features = false` for this crate on your `Cargo.toml`. |
| 40 | |
| 41 | ## Note about MSRV |
| 42 | |
| 43 | Dependencies' MSRVs evolve independently of this crate's MSRV. |
| 44 | Old versions of cargo will always try to get the most recent versions of the dependencies. |
| 45 | Therefore, if you are having troubles compiling on an old Rust version, try to install an older version of the incompatible dependency. |
| 46 | |
| 47 | For instance, to compile on Rust 1.36, `tinyvec` must be `<=1.6.0` |
| 48 | |
| 49 | ```sh |
| 50 | cargo update -p tinyvec --precise 1.6.0 |
| 51 | ``` |