diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx | 5 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 15 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx index ef6070e84..f7d37fecb 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx @@ -406,10 +406,7 @@ unsigned Fl_WinAPI_System_Driver::utf8fromwc(char* dst, unsigned dstlen, const w int Fl_WinAPI_System_Driver::utf8locale() { - static int ret = 2; - if (ret == 2) { - ret = GetACP() == CP_UTF8; - } + static int ret = (GetACP() == CP_UTF8); return ret; } 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; } |
