-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
According to this specification, the POSIX locale is defined as:
language[_territory][.codeset][@modifier]
For example, the locale De_DE@dict is valid.
However, the current implementation of the library does not check for the @ character, leading to an invalid locale detection when the codeset is not present but the modifier is.
Example:
let fr_FR_euro = "fr_FR@euro".to_owned();
let mut env = MockEnv::new();
env.insert("LANGUAGE".into(), fr_FR_euro);
env.insert("LC_ALL".into(), fr_FR_euro);
env.insert("LC_MESSAGES".into(), fr_FR_euro);
env.insert("LANG".into(), fr_FR_euro);
env.insert("LC_CTYPE".into(), fr_FR_euro);
let locale = _get(&env);
// locale is equal to "fr-FR@euro" which is not a valid BCP 47 localeThe simplest possible solution would be:
- Crop the POSIX locale at the minimum index of
.and@characters. Resolved in unix.rs: Added POSIX modifiers support for BCP 47 conversion #33.
However, since some POSIX modifiers might be convertible to BCP 47, a more complex solution would be:
- Implement full support for POSIX modifiers, meaning the library would use the modifier information to form the resulting BCP 47 locale.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels