diff --git a/Cargo.lock b/Cargo.lock index 9aff0431..71b7b1bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -498,7 +498,7 @@ dependencies = [ "clicolors-control", "lazy_static 1.4.0", "libc", - "parking_lot 0.6.4", + "parking_lot 0.11.2", "regex", "termios", "unicode-width", @@ -1999,6 +1999,7 @@ dependencies = [ "home", "jsonrpc-lite", "lapce-rpc", + "locale_config", "lsp-types", "mio 0.6.23", "notify", @@ -2140,6 +2141,19 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "locale_config" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d2c35b16f4483f6c26f0e4e9550717a2f6575bcd6f12a53ff0c490a94a6934" +dependencies = [ + "lazy_static 1.4.0", + "objc", + "objc-foundation", + "regex", + "winapi 0.3.9", +] + [[package]] name = "lock_api" version = "0.1.5" diff --git a/proxy/Cargo.toml b/proxy/Cargo.toml index 957f5e46..64fc2ad7 100644 --- a/proxy/Cargo.toml +++ b/proxy/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Dongdong Zhou "] edition = "2018" [dependencies] +locale_config = "0.3.0" base64 = "0.13.0" alacritty_terminal = "0.15.0" mio = "0.6.20" diff --git a/proxy/src/terminal.rs b/proxy/src/terminal.rs index 698c05aa..7424a0a8 100644 --- a/proxy/src/terminal.rs +++ b/proxy/src/terminal.rs @@ -75,6 +75,10 @@ pub fn new( args: vec!["-l".to_string()], }); setup_env(&config); + + #[cfg(target_os = "macos")] + set_locale_environment(); + let size = SizeInfo::new(width as f32, height as f32, 1.0, 1.0, 0.0, 0.0, true); let mut pty = alacritty_terminal::tty::new(&config, &size, None); @@ -308,3 +312,8 @@ fn set_current(&mut self, new: Option) { self.writing = new; } } + +fn set_locale_environment() { + let locale = locale_config::Locale::global_default().to_string().replace("-", "_"); + std::env::set_var("LC_ALL", locale + ".UTF-8"); +}