Fix pasting BOARD_ITEMs containing Unicode characters

Fixes: lp:1749549
* https://bugs.launchpad.net/kicad/+bug/1749549
This commit is contained in:
Maciej Suminski 2018-03-13 09:26:34 +01:00
parent 83efd6b8a3
commit 8567eab09a
1 changed files with 6 additions and 5 deletions

View File

@ -190,7 +190,8 @@ void CLIPBOARD_IO::SaveSelection( const SELECTION& aSelected )
BOARD_ITEM* CLIPBOARD_IO::Parse() BOARD_ITEM* CLIPBOARD_IO::Parse()
{ {
std::string result; BOARD_ITEM* item;
wxString result;
if( wxTheClipboard->Open() ) if( wxTheClipboard->Open() )
{ {
@ -198,18 +199,18 @@ BOARD_ITEM* CLIPBOARD_IO::Parse()
{ {
wxTextDataObject data; wxTextDataObject data;
wxTheClipboard->GetData( data ); wxTheClipboard->GetData( data );
result = data.GetText();
result = data.GetText().mb_str();
} }
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
BOARD_ITEM *item;
try try
{ {
item = PCB_IO::Parse( result ); item = PCB_IO::Parse( result );
} catch (...) { }
catch (...)
{
item = nullptr; item = nullptr;
} }