Closed cristian-bicheru closed 2 months ago
Hi,
Very nice catch !
I couldn't find any reference to this in either the Symbol Library File Format or the S-Expression Format documentation.
So I delved into the KiCad source code and discovered the code that handles the escaping of this sequence in the string_utils.cpp file.
Within, additional escape expressions are revealed:
else if( aContext == CTX_LIBID || aContext == CTX_LEGACY_LIBID )
{
// We no longer escape '/' in LIB_IDs, but we used to
if( c == '/' && aContext == CTX_LEGACY_LIBID )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
else if( c == '<' )
converted += wxT( "{lt}" );
else if( c == '>' )
converted += wxT( "{gt}" );
else if( c == ':' )
converted += wxT( "{colon}" );
else if( c == '\"' )
converted += wxT( "{dblquote}" );
else if( c == '\n' || c == '\r' )
converted += wxEmptyString; // drop
else
converted += c;
}
I will check this tomorrow and add the missing escape sequences.
Thanks for your PR ;)
Ah, nice catch -- I took a peek in the source as well but didn't find that code block. Sounds good, I will close this PR then!
Available on the 1.0.32 release :)
Hi, Great work on this awesome library!
I recently ran into an issue converting LCSC parts with colons in the name (e.g, C2838450). It appears that KiCad does not allow the colon character in symbol names, thus the generated symbol library cannot be imported.
As an experiment, I went into KiCad and created a symbol with the colon character in the title. To my surprise, this seemed to work without any issues. When I inspected the symbol library, I found that KiCad had inserted the text
{colon}
in place of the character.Thus, I added another operation to replace all occurances of
:
with{colon}
in the component title. Now, the generated symbol library appears to load as expected.