summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormetalefty <meta@vmeta.jp>2016-08-23 10:32:37 +0900
committerGitHub <noreply@github.com>2016-08-23 10:32:37 +0900
commite28f529a94143eb47bdc04bb675f74336fb4cb96 (patch)
tree21a4a524c4d57af7a2cd44292e5b9d7bcb1fa2a5
parentf4f23b0a7d893c871092dcb2f53f733d3909e370 (diff)
parentceb4b7b2a45f4c4ce791629f20a144db68d89bb5 (diff)
downloadxrdp-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.c16
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);
}