Rust 使用草书SelectView时出现的奇怪字符
这是我的密码:Rust 使用草书SelectView时出现的奇怪字符,rust,ncurses,tui,Rust,Ncurses,Tui,这是我的密码: extern crate cursive; use cursive::Cursive; use cursive::views::{SelectView, Dialog}; use cursive::align::HAlign; fn main() { let mut time_select = SelectView::new().h_align(HAlign::Center); time_select.add_item("Short", 1); tim
extern crate cursive;
use cursive::Cursive;
use cursive::views::{SelectView, Dialog};
use cursive::align::HAlign;
fn main() {
let mut time_select = SelectView::new().h_align(HAlign::Center);
time_select.add_item("Short", 1);
time_select.add_item("Medium", 5);
time_select.add_item("Long", 10);
let mut siv = Cursive::new();
siv.add_layer(Dialog::around(time_select).title("How long is your wait?"));
siv.run();
}
这就是结果:
这种情况发生在多个终端模拟器上。我如何解决这个问题?在通过
vim
编辑时,我遇到了这种情况,以这种方式运行解决了这个问题:
LANG=en_US.UTF-8 cargo run
如果您使用的是
bash
或另一个支持以这种方式设置环境的shell,那么这应该可以工作。Cursive需要UTF-8输出。您的终端的$LANG
设置了什么?我正在使用en_GB.UTF-8,其他UTF-8字符也可以使用。它在pterm和gnome终端中对我有效。我还怀疑你的终端不是真正的UTF-8;如果我将终端编码更改为非UTF-8,我可以得到类似的效果。