From 993a684959b2e5db9397e3f11d524e94573c25be Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 17 Nov 2020 12:23:46 +0100 Subject: [PATCH] .kicad_sym files: Fix an issue when a symbol name contains a double quote. This char (accepted in dialog) was escaped in some places, but not all. So if a symbol name contained a double quote, the lib file was broken. --- eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 01942f7165..3efb3bb34f 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -1605,8 +1605,11 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo for( auto unit : units ) { - aFormatter.Print( aNestLevel + 1, "(symbol \"%s_%d_%d\"\n", - unitName.c_str(), unit.m_unit, unit.m_convert ); + name = aFormatter.Quotew( unitName ); // Add quotes and escape chars like ") + name.pop_back(); // Remove last char: the quote ending the string. + + aFormatter.Print( aNestLevel + 1, "(symbol \%s_%d_%d\"\n", + name.c_str(), unit.m_unit, unit.m_convert ); for( auto item : unit.m_items ) saveSymbolDrawItem( item, aFormatter, aNestLevel + 2 );