diff options
author | metalefty <meta@vmeta.jp> | 2016-08-23 10:32:37 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-23 10:32:37 +0900 |
commit | e28f529a94143eb47bdc04bb675f74336fb4cb96 (patch) | |
tree | 21a4a524c4d57af7a2cd44292e5b9d7bcb1fa2a5 | |
parent | f4f23b0a7d893c871092dcb2f53f733d3909e370 (diff) | |
parent | ceb4b7b2a45f4c4ce791629f20a144db68d89bb5 (diff) | |
download | xrdp-proprietary-e28f529a94143eb47bdc04bb675f74336fb4cb96.tar.gz xrdp-proprietary-e28f529a94143eb47bdc04bb675f74336fb4cb96.zip |
Merge pull request #410 from metalefty/fix-utf8-clipboard
Fix clipboard when text/filename contains non-ASCII characters
-rw-r--r-- | common/os_calls.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index 234e01c7..c58ebd60 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -136,7 +136,21 @@ g_init(const char *app_name) WSAStartup(2, &wsadata); #endif - setlocale(LC_CTYPE, ""); + + /* In order to get g_mbstowcs and g_wcstombs to work properly with + UTF-8 non-ASCII characters, LC_CTYPE cannot be "C" or blank. + To select UTF-8 encoding without specifying any countries/languages, + "C.UTF-8" is used but provided in few systems. + + See also: https://sourceware.org/glibc/wiki/Proposals/C.UTF-8 */ + char *lc_ctype; + lc_ctype = setlocale(LC_CTYPE, "C.UTF-8"); + if (lc_ctype == NULL) + { + /* use en_US.UTF-8 instead if not available */ + setlocale(LC_CTYPE, "en_US.UTF-8"); + } + g_mk_temp_dir(app_name); } |