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 locale
The simplest possible solution would be:
However, since some POSIX modifiers might be convertible to BCP 47, a more complex solution would be:
According to this specification, the POSIX locale is defined as:
For example, the locale
De_DE@dictis 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:
The simplest possible solution would be:
.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: