Eeschema: fix schematic symbol parsing bug.

Schematic symbol library link names are unquoted strings that can
contain non-ascii characters which breaks the parser.  Converting
the line to uft-8 before breaking the string into tokens resolves
the issue.
This commit is contained in:
Wayne Stambaugh 2018-12-06 12:44:13 -05:00
parent 742961119d
commit b8de4e73bf
1 changed files with 9 additions and 3 deletions

View File

@ -1426,8 +1426,15 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
if( strCompare( "L", line, &line ) )
{
wxString libName;
size_t pos = 2; // "X" plus ' ' space character.
wxString utf8Line = wxString::FromUTF8( line );
wxStringTokenizer tokens( utf8Line, " \r\n\t" );
parseUnquotedString( libName, aReader, line, &line );
if( tokens.CountTokens() < 2 )
THROW_PARSE_ERROR( "invalid symbol library definition", aReader.GetSource(),
aReader.Line(), aReader.LineNumber(), pos );
libName = tokens.GetNextToken();
libName.Replace( "~", " " );
LIB_ID libId;
@ -1442,9 +1449,8 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
component->SetLibId( libId );
wxString refDesignator;
wxString refDesignator = tokens.GetNextToken();
parseUnquotedString( refDesignator, aReader, line, &line );
refDesignator.Replace( "~", " " );
wxString prefix = refDesignator;