Function unic_locale_impl::canonicalize

source ·
pub fn canonicalize<S: AsRef<[u8]>>(input: S) -> Result<String, LocaleError>
Expand description

This is a best-effort operation that performs all available levels of canonicalization.

At the moment the operation will normalize casing and the separator, but in the future it may also validate and update from deprecated subtags to canonical ones.

§Examples

use unic_locale_impl::canonicalize;

assert_eq!(canonicalize("pL_latn_pl-U-HC-H12"), Ok("pl-Latn-PL-u-hc-h12".to_string()));