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 71e7b4b77b)
This commit is contained in:
Seth Hillbrand 2022-01-05 17:16:54 -08:00
parent 88a8ad2ca1
commit 3ace4446e7
1 changed files with 6 additions and 1 deletions

View File

@ -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<LIB_SYMBOL>& 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] == '~' )