From 77617a97eca24f5bf33c7f73dac48a3136a3d978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Sun, 22 Nov 2015 13:57:51 +0100 Subject: [PATCH] Initialize locale upon startup. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that Xlib input contexts assume a C locale when the locale hasn’t been initialized from the environment before the input context is created. Inter alia, this will lead to Xlib reading the .XCompose definition file as ISO-8859-1, which will result in mojibake when composing characters in a UTF-8 environment (cf. #268). --- source/rofi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/rofi.c b/source/rofi.c index acfb0b82..dfa6d986 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -2321,6 +2322,10 @@ int main ( int argc, char *argv[] ) display_str = getenv ( "DISPLAY" ); find_arg_str ( "-display", &display_str ); + if ( setlocale ( LC_ALL, "" ) == NULL ) { + fprintf ( stderr, "Failed to set locale.\n" ); + return EXIT_FAILURE; + } if ( !XSupportsLocale () ) { fprintf ( stderr, "X11 does not support locales\n" ); return 11;