Convert wide chars before reading model
The PEGTL parser used by KiCad for SPICE models only handles ASCII characters. Despite the docs stating that you can, in theory, parse a UTF-8 character by reading the base string, in pratice this does not work as the UTF-8 string is represented by unsigned chars and the PEGTL string is based on signed char. To work around this, we need to convert micro and mu to the ASCII 'u' equivalent Fixes https://gitlab.com/kicad/code/kicad/issues/13642
This commit is contained in:
parent
12b0a12d74
commit
00f93db2ff
|
@ -1107,6 +1107,11 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector<T_field>* aFields,
|
|||
auto convertNotation =
|
||||
[&]( const wxString& units ) -> wxString
|
||||
{
|
||||
/// KiCad Spice PEGTL only handles ASCII
|
||||
/// Although these two look the same, they are U+03BC and U+00B5
|
||||
if( units == wxS( "µ" ) || units == wxS( "μ" ) )
|
||||
return wxS( "u" );
|
||||
|
||||
if( aNotation == SIM_VALUE_GRAMMAR::NOTATION::SPICE )
|
||||
{
|
||||
if( units == wxT( "M" ) )
|
||||
|
|
Loading…
Reference in New Issue