From 3ace4446e7f2e90b53811e1e86adcc67b1f545ae 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 (cherry picked from commit 71e7b4b77b700441d31426c216adcd490d283d26) --- 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 d08bad892c..fa033a8986 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -2728,7 +2728,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 ); @@ -2835,6 +2834,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(); @@ -3072,6 +3072,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] == '~' )