diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index 6092bf74..82332085 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -25,6 +25,7 @@ #include #include #include +#include WIN32Window::WIN32Window() { @@ -665,7 +666,7 @@ std::string WIN32Window::getClipboardText() if(hglb) { LPTSTR lptstr = (LPTSTR)GlobalLock(hglb); if(lptstr) { - text = lptstr; + text = Fw::utf8StringToLatin1((uchar*)lptstr); GlobalUnlock(hglb); } } diff --git a/src/framework/util/utf8.cpp b/src/framework/util/utf8.cpp index f92e120b..1ad64377 100644 --- a/src/framework/util/utf8.cpp +++ b/src/framework/util/utf8.cpp @@ -27,16 +27,22 @@ char Fw::utf8CharToLatin1(uchar *utf8, int *read) { - if(utf8[0] == 0xc3) { + char c = '?'; + uchar opt1 = utf8[0]; + if(opt1 == 0xc3) { *read = 2; - return (char)(64 + utf8[1]); - } else if(utf8[0] == 0xc2) { + uchar opt2 = utf8[1]; + c = 64 + opt2; + } else if(opt1 == 0xc2) { *read = 2; - return utf8[1]; - } else { + uchar opt2 = utf8[1]; + if(opt2 > 0xa1 && opt2 < 0xbb) + c = opt2; + } else if(opt1 < 0xc2) { *read = 1; - return utf8[0]; + c = opt1; } + return c; } std::string Fw::utf8StringToLatin1(uchar *utf8) {