mirror of
https://github.com/davatorium/rofi.git
synced 2025-01-27 15:25:24 -05:00
Initialize locale upon startup.
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).
This commit is contained in:
parent
5bdcd47dde
commit
77617a97ec
1 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue