Merge pull request #1254 from yan12125/fix-wrong-encoding-for-text-copied-between-linux-and-windows
Fix wrong encoding for text copied between linux and windows
This commit is contained in:
commit
ac5a1bfd3b
|
@ -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
|
||||
{
|
||||
return Unicode::UTF8ToUTF16(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
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