From 16f58f2018d29c16dc3fa67ef6012b156aa69da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Fri, 3 Jul 2020 16:55:31 -0300 Subject: [PATCH] String to std::string is now always converted to UTF-8. UICodeEditor and UITextInput copy/paste fix. --- src/eepp/core/string.cpp | 2 +- src/eepp/ui/uicodeeditor.cpp | 4 ++-- src/eepp/ui/uitextinput.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/eepp/core/string.cpp b/src/eepp/core/string.cpp index d69ff1c7a..ef217d5c1 100644 --- a/src/eepp/core/string.cpp +++ b/src/eepp/core/string.cpp @@ -579,7 +579,7 @@ String String::fromUtf8( const std::string& utf8String ) { } String::operator std::string() const { - return toAnsiString(); + return toUtf8(); } std::string String::toAnsiString( const std::locale& locale ) const { diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 1d4a3b782..0584d7148 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -1567,11 +1567,11 @@ void UICodeEditor::unindent() { } void UICodeEditor::copy() { - getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getSelectedText() ); + getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getSelectedText().toUtf8() ); } void UICodeEditor::cut() { - getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getSelectedText() ); + getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getSelectedText().toUtf8() ); mDoc->deleteSelection(); } diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index 17aa80439..8cc44970b 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -664,11 +664,11 @@ UITextView* UITextInput::setHintFontStyle( const Uint32& fontStyle ) { } void UITextInput::copy() { - getUISceneNode()->getWindow()->getClipboard()->setText( mDoc.getSelectedText() ); + getUISceneNode()->getWindow()->getClipboard()->setText( mDoc.getSelectedText().toUtf8() ); } void UITextInput::cut() { - getUISceneNode()->getWindow()->getClipboard()->setText( mDoc.getSelectedText() ); + getUISceneNode()->getWindow()->getClipboard()->setText( mDoc.getSelectedText().toUtf8() ); mDoc.deleteSelection(); }