From 3e64c9de381a467d0d86c88dd32d11fc2aa559bd Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 15 Apr 2018 10:06:53 +0200 Subject: [PATCH] Fix incorrect behavior of ReplaceIllegalFileNameChars( wxString& aName, int aReplaceChar ) for non ASCII8 chars. (this function was using a comparison using chars to test wide chars) Fixes: lp:1764055 https://bugs.launchpad.net/kicad/+bug/1764055 --- common/string.cpp | 3 ++- eeschema/libedit.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/string.cpp b/common/string.cpp index 8932fbc187..d0375c55af 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -515,10 +515,11 @@ bool ReplaceIllegalFileNameChars( wxString& aName, int aReplaceChar ) bool changed = false; wxString result; result.reserve( aName.Length() ); + wxString illWChars = GetIllegalFileNameWxChars(); for( wxString::iterator it = aName.begin(); it != aName.end(); ++it ) { - if( strchr( illegalFileNameChars, *it ) ) + if( illWChars.Find( *it ) != wxNOT_FOUND ) { if( aReplaceChar ) result += aReplaceChar; diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 51630e861e..287f4f7f25 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -296,6 +296,7 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event ) } wxString name = dlg.GetName(); + // Currently, symbol names cannot include a space, that breaks libraries: name.Replace( " ", "_" ); // Test if there is a component with this name already.