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:
parent
742961119d
commit
b8de4e73bf
|
@ -1426,8 +1426,15 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
|
||||||
if( strCompare( "L", line, &line ) )
|
if( strCompare( "L", line, &line ) )
|
||||||
{
|
{
|
||||||
wxString libName;
|
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( "~", " " );
|
libName.Replace( "~", " " );
|
||||||
|
|
||||||
LIB_ID libId;
|
LIB_ID libId;
|
||||||
|
@ -1442,9 +1449,8 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
|
||||||
|
|
||||||
component->SetLibId( libId );
|
component->SetLibId( libId );
|
||||||
|
|
||||||
wxString refDesignator;
|
wxString refDesignator = tokens.GetNextToken();
|
||||||
|
|
||||||
parseUnquotedString( refDesignator, aReader, line, &line );
|
|
||||||
refDesignator.Replace( "~", " " );
|
refDesignator.Replace( "~", " " );
|
||||||
|
|
||||||
wxString prefix = refDesignator;
|
wxString prefix = refDesignator;
|
||||||
|
|
Loading…
Reference in New Issue