fix paste of text with accents in win32
This commit is contained in:
parent
9b8043cf31
commit
490eae7814
|
@ -25,6 +25,7 @@
|
||||||
#include <framework/application.h>
|
#include <framework/application.h>
|
||||||
#include <framework/thirdparty/apngloader.h>
|
#include <framework/thirdparty/apngloader.h>
|
||||||
#include <framework/core/resourcemanager.h>
|
#include <framework/core/resourcemanager.h>
|
||||||
|
#include <framework/util/utf8.h>
|
||||||
|
|
||||||
WIN32Window::WIN32Window()
|
WIN32Window::WIN32Window()
|
||||||
{
|
{
|
||||||
|
@ -665,7 +666,7 @@ std::string WIN32Window::getClipboardText()
|
||||||
if(hglb) {
|
if(hglb) {
|
||||||
LPTSTR lptstr = (LPTSTR)GlobalLock(hglb);
|
LPTSTR lptstr = (LPTSTR)GlobalLock(hglb);
|
||||||
if(lptstr) {
|
if(lptstr) {
|
||||||
text = lptstr;
|
text = Fw::utf8StringToLatin1((uchar*)lptstr);
|
||||||
GlobalUnlock(hglb);
|
GlobalUnlock(hglb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,22 @@
|
||||||
|
|
||||||
char Fw::utf8CharToLatin1(uchar *utf8, int *read)
|
char Fw::utf8CharToLatin1(uchar *utf8, int *read)
|
||||||
{
|
{
|
||||||
if(utf8[0] == 0xc3) {
|
char c = '?';
|
||||||
|
uchar opt1 = utf8[0];
|
||||||
|
if(opt1 == 0xc3) {
|
||||||
*read = 2;
|
*read = 2;
|
||||||
return (char)(64 + utf8[1]);
|
uchar opt2 = utf8[1];
|
||||||
} else if(utf8[0] == 0xc2) {
|
c = 64 + opt2;
|
||||||
|
} else if(opt1 == 0xc2) {
|
||||||
*read = 2;
|
*read = 2;
|
||||||
return utf8[1];
|
uchar opt2 = utf8[1];
|
||||||
} else {
|
if(opt2 > 0xa1 && opt2 < 0xbb)
|
||||||
|
c = opt2;
|
||||||
|
} else if(opt1 < 0xc2) {
|
||||||
*read = 1;
|
*read = 1;
|
||||||
return utf8[0];
|
c = opt1;
|
||||||
}
|
}
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Fw::utf8StringToLatin1(uchar *utf8) {
|
std::string Fw::utf8StringToLatin1(uchar *utf8) {
|
||||||
|
|
Loading…
Reference in New Issue