In my ncurses program if I have two pieces of code:
1:
if env::var_os("ESCDELAY").is_none() {}
2:
unsafe {
let _ = locale::setlocale(locale::LC_ALL, b"en_US.UTF-8".as_ptr() as *const i8);
}
If 2 is before 1, then unicode in my program breaks. If 1 is before 2 everything is fine.
The bindings to setlocale that I use are:
mod locale {
use libc::{c_int, c_char};
pub const LC_ALL: c_int = 6;
extern "C" {
pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char;
}
}
My guess is that std::env is not expecting setlocale changing the underlying environment or something like that. I'm not sure if it's OK, and should it be documented, but decided to let you know, as it was really confusing.
In my ncurses program if I have two pieces of code:
1:
2:
If 2 is before 1, then unicode in my program breaks. If 1 is before 2 everything is fine.
The bindings to setlocale that I use are:
My guess is that
std::envis not expectingsetlocalechanging the underlying environment or something like that. I'm not sure if it's OK, and should it be documented, but decided to let you know, as it was really confusing.