diff --git a/common/string.cpp b/common/string.cpp index e60d6424e6..30dbf788cc 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -209,8 +209,12 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize ) } -std::string EscapedUTF8( const wxString& aString ) +std::string EscapedUTF8( wxString aString ) { + // No new-lines allowed in quoted strings + aString.Replace( "\r\n", "\r" ); + aString.Replace( "\n", "\r" ); + std::string utf8 = TO_UTF8( aString ); std::string ret; diff --git a/include/kicad_string.h b/include/kicad_string.h index d0db7a13bb..5d6e655b25 100644 --- a/include/kicad_string.h +++ b/include/kicad_string.h @@ -81,7 +81,7 @@ int ReadDelimitedText( wxString* aDest, const char* aSource ); * @param aString is the input string to convert. * @return std::string - the escaped input text, without the wrapping double quotes. */ -std::string EscapedUTF8( const wxString& aString ); +std::string EscapedUTF8( wxString aString ); /** * Return a new wxString escaped for embedding in HTML.