From 9b217bf36a0cfc2a68897a63fc7958a688236660 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Tue, 9 Aug 2011 08:31:21 +0800 Subject: [PATCH 1/2] Add setlocale() calls to all UIs. --- client/DirectFB/dfreerdp.c | 3 +++ client/X11/xfreerdp.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index 16ef15efe..88714eb25 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -361,6 +362,8 @@ int main(int argc, char* argv[]) struct thread_data* data; rdpChanMan* chanman; + setlocale(LC_ALL, ""); + freerdp_chanman_global_init(); g_sem = freerdp_sem_new(1); diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index a10d9fb38..7e86250c7 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -591,6 +592,8 @@ int main(int argc, char* argv[]) struct thread_data* data; rdpChanMan* chanman; + setlocale(LC_ALL, ""); + freerdp_chanman_global_init(); g_sem = freerdp_sem_new(1); From 80f56f5e8ffa9aaddaff07bc38615924a36d5e64 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Tue, 9 Aug 2011 12:23:27 +0800 Subject: [PATCH 2/2] libfreerdp-utils/unicode: use towupper for unicode uppercase. --- libfreerdp-utils/unicode.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libfreerdp-utils/unicode.c b/libfreerdp-utils/unicode.c index 3d7b801f7..fb5150d1e 100644 --- a/libfreerdp-utils/unicode.c +++ b/libfreerdp-utils/unicode.c @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -187,13 +188,21 @@ char* freerdp_uniconv_out(UNICONV *uniconv, char *str, size_t *pout_len) void freerdp_uniconv_uppercase(UNICONV *uniconv, char *wstr, int length) { int i; - char* p; + unsigned char* p; + unsigned int wc, uwc; - p = wstr; + p = (unsigned char*)wstr; for (i = 0; i < length; i++) { - if (p[i * 2] >= 'a' && p[i * 2] <= 'z') - p[i * 2] = p[i * 2] - 32; + wc = (unsigned int)(*p); + wc += (unsigned int)(*(p + 1)) << 8; + uwc = towupper(wc); + if (uwc != wc) + { + *p = uwc & 0xFF; + *(p + 1) = (uwc >> 8) & 0xFF; + } + p += 2; } }