From 32144b83c1ba2517b969a0fcd6b15f1e75355742 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Fri, 27 May 2016 07:33:41 +0200 Subject: [PATCH] mosh: Fix mosh C++ wrapper to set locale envs Set the -l flags ("Locale-related environment variable to try as part of a fallback environment, if the startup environment does not specify a character set of UTF-8") when invoking mosh-server just like the perl script does. Fixes #288. --- packages/mosh/mosh.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/mosh/mosh.cc b/packages/mosh/mosh.cc index 9f0352e6..5afaa284 100644 --- a/packages/mosh/mosh.cc +++ b/packages/mosh/mosh.cc @@ -389,6 +389,19 @@ int main( int argc, char *argv[] ) server_args.push_back( "-p" ); server_args.push_back( port_request ); } + + for (char const* env_name : { + "LANG", "LANGUAGE", "LC_CTYPE", "LC_NUMERIC", + "LC_TIME", "LC_COLLATE", "LC_MONETARY", "LC_MESSAGES", "LC_PAPER", + "LC_NAME", "LC_ADDRESS", "LC_TELEPHONE", "LC_MEASUREMENT", + "LC_IDENTIFICATION", "LC_ALL" }) { + char* env_value = getenv(env_name); + if (env_value) { + server_args.push_back("-l"); + server_args.push_back(string(env_name) + "=" + env_value); + } + } + if ( commands ) { server_args.insert( server_args.end(), command, command + commands ); } -- 2.11.0