diff options
Diffstat (limited to 'src/drivers/X11')
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx index c64772143..bea584c11 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.cxx +++ b/src/drivers/X11/Fl_X11_System_Driver.cxx @@ -500,11 +500,16 @@ int Fl_X11_System_Driver::filename_list(const char *d, dirent ***list, int (*sor } int Fl_X11_System_Driver::utf8locale() { - char *s; - static int ret = ((s = ::getenv("LC_CTYPE")) && *s) || - ((s = ::getenv("LC_ALL")) && *s) || - ((s = ::getenv("LANG")) && *s) - ? 1 : 0; + static int ret = 2; + if (ret == 2) { + char* s; + ret = 1; /* assume UTF-8 if no locale */ + if (((s = getenv("LC_CTYPE")) && *s) || + ((s = getenv("LC_ALL")) && *s) || + ((s = getenv("LANG")) && *s)) { + ret = (strstr(s,"utf") || strstr(s,"UTF")); + } + } return ret; } |
