lib/platform: Fix encoding for text copied between linux and windows
Copied from https://github.com/symless/synergy-core/pull/7029. I don't include the application/x-moz-nativehtml part in that patch as I already added it in https://github.com/debauchee/barrier/pull/1164. Fixes https://github.com/debauchee/barrier/issues/1037 Fixes https://github.com/debauchee/barrier/issues/1137 Original author: Serhii Hadzhilov <serhii-external@symless.com>
This commit is contained in:
parent
e010f89f41
commit
dd3ea8adfe
|
@ -0,0 +1,2 @@
|
||||||
|
Fix wrong encoding for text copied between Linux and Windows
|
||||||
|
(https://github.com/debauchee/barrier/issues/1037, https://github.com/debauchee/barrier/issues/1137).
|
|
@ -56,10 +56,17 @@ XWindowsClipboardHTMLConverter::getDataSize() const
|
||||||
|
|
||||||
std::string XWindowsClipboardHTMLConverter::fromIClipboard(const std::string& data) const
|
std::string XWindowsClipboardHTMLConverter::fromIClipboard(const std::string& data) const
|
||||||
{
|
{
|
||||||
return Unicode::UTF8ToUTF16(data);
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string XWindowsClipboardHTMLConverter::toIClipboard(const std::string& data) const
|
std::string XWindowsClipboardHTMLConverter::toIClipboard(const std::string& data) const
|
||||||
{
|
{
|
||||||
return Unicode::UTF16ToUTF8(data);
|
// Older Firefox [1] and possibly other applications use UTF-16 for text/html - handle both
|
||||||
|
// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1497580
|
||||||
|
if (Unicode::isUTF8(data)) {
|
||||||
|
return data;
|
||||||
|
} else {
|
||||||
|
return Unicode::UTF16ToUTF8(data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue