From 512ba167e8a014450005baf6e5585fcebf8b8d93 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 18 Oct 2021 10:35:21 -0700 Subject: [PATCH] Escape symbols when adding to library Can't escape by default because the allowed characters differ in the read-only libraries and existing schematics that reference them. So, escape when we import into standard KiCad Libraries Fixes https://gitlab.com/kicad/code/kicad/issues/9419 --- eeschema/symbol_editor/symbol_editor_import_export.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eeschema/symbol_editor/symbol_editor_import_export.cpp b/eeschema/symbol_editor/symbol_editor_import_export.cpp index 65aa1051a6..6f2803adaf 100644 --- a/eeschema/symbol_editor/symbol_editor_import_export.cpp +++ b/eeschema/symbol_editor/symbol_editor_import_export.cpp @@ -91,7 +91,9 @@ void SYMBOL_EDIT_FRAME::ImportSymbol() wxString symbolName = symbols[0]; LIB_SYMBOL* entry = pi->LoadSymbol( fn.GetFullPath(), symbolName ); - if( m_libMgr->SymbolExists( symbols[0], libName ) ) + entry->SetName( EscapeString( entry->GetName(), CTX_LIBID ) ); + + if( m_libMgr->SymbolExists( entry->GetName(), libName ) ) { msg.Printf( _( "Symbol %s already exists in library '%s'." ), symbolName, libName ); @@ -105,7 +107,7 @@ void SYMBOL_EDIT_FRAME::ImportSymbol() m_libMgr->UpdateSymbol( entry, libName ); SyncLibraries( false ); - LoadSymbol( symbolName, libName, 1 ); + LoadSymbol( entry->GetName(), libName, 1 ); }