[mosh-devel] Mosh and setlocale(LC_ALL,"")
Goffredo Baroncelli
kreijack at libero.it
Tue Dec 10 06:20:02 EST 2013
Hi all,
I am facing the problem related to locale, when the host locale doesn't
match with the server locale.
The reason is that I have an uncommon setting of the environment
variable LC_TIME, which is set to en_DK.utf8 [1].
To avoid this problem I have to call mosh as below
LC_TIME= mosh <server>
and everything work properly.
Looking at the code, I noticed that in set_native_locale(), it is called
setlocale( LC_ALL, "" ).
Unfortunately this function fails even if *one* setting of the LC_*
doesn't match. This is what I saw.
However I suppose that mosh should care only about the LC_CTYPE setting.
If so, the following patch should narrow the cases where mosh fails when
the environments differ.
diff --git a/src/util/locale_utils.cc b/src/util/locale_utils.cc
index 11923ff..9e9eb0c 100644
--- a/src/util/locale_utils.cc
+++ b/src/util/locale_utils.cc
@@ -95,7 +95,7 @@ bool is_utf8_locale( void ) {
void set_native_locale( void ) {
/* Adopt native locale */
- if ( NULL == setlocale( LC_ALL, "" ) ) {
+ if ( NULL == setlocale( LC_CTYPE, "" ) ) {
int saved_errno = errno;
if ( saved_errno == ENOENT ) {
LocaleVar ctype( get_ctype() );
In my case it works, but I don't know very well how mosh interact with
locale.
Comments ?
BR
G.Baroncelli
[1] For the record, I have this setting to see in thunderbird a "date
which is readable.... but this is another story.
--
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
More information about the mosh-devel
mailing list