From 71e7b4b77b700441d31426c216adcd490d283d26 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 5 Jan 2022 17:16:54 -0800 Subject: [PATCH] Use 'special' escaping for certain fields Most fields are escaped using the `\` notation. But the VALUE field and the symbol name need to be escaped using braces notation. Fixes https://gitlab.com/kicad/code/kicad/issues/10097 --- eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index a7f72b6513..ad680f5cf8 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -2727,7 +2727,6 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs() aliasName = wxString::FromUTF8( line ); aliasName.Trim(); - // aliasName = EscapeString( aliasName, CTX_LIBID ); LIB_SYMBOL_MAP::iterator it = m_symbols.find( aliasName ); @@ -2834,6 +2833,7 @@ LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorV wxString name, prefix, tmp; name = tokens.GetNextToken(); + name = EscapeString( name, CTX_LIBID ); pos += name.size() + 1; prefix = tokens.GetNextToken(); @@ -3071,6 +3071,11 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr& aSymbol, parseQuotedString( text, aReader, line, &line, true ); + // The value field needs to be "special" escaped. The other fields are + // escaped normally and don't need special handling + if( id == VALUE_FIELD ) + text = EscapeString( text, CTX_QUOTED_STR ); + // Doctor the *.lib file field which has a "~" in blank fields. New saves will // not save like this. if( text.size() == 1 && text[0] == '~' )