% character allowed in symbol names?

I have seen some examples here lately where someone reported using custom symbols where the % character is used in resistor names to designate tolerance, like R_0805_10k_1%_crcw080510k0fkea. However the KLC, G1.1, only defines allowable characters as the following (https://kicad.org/libraries/klc/):
Alphanumeric characters (A-Z, a-z, 0-9)
Underscore _
Hyphen / dash -
Period / dot .
Comma ,
Plus symbol +
A test under Win7, the R_0805_10k_1%_crcw080510k0fkea will export well as a standalone library file name, but this might not be the case under different operative systems? So one should write out % as percent instead?
The background for the question is that writing out percent takes a lot of space, so I am not inclined to use tolerance in “molecular” resistor names except for the ones with especially high tolerance. However if one could just add for instance 1%, it would not add much length to the symbol name.

The KLC is written very conservative in this regard. We don’t really have the time to test under all platforms.
For your personal libs this is a lot easier.

You could use a prefix like Tol. Would then mean you have a name like R_0805_10k_Tol1.0_

I think the code checks for 9 reserved characters that may cause problems with filenames: /:*?|"<> or at least that is the set to avoid. Some may actually be valid on specific OSes, but obviously for portability should still be avoided.

I am not sure if other characters might cause problems, % is used for special strings such as “%R”.

The restriction is in place because in the future symbols will be stored in single files much like the current footprint format. Thus, characters which cannot be used in valid filenames are disallowed. Mostly to make our life easier when the file format transition is enacted.

2 Likes

Thanks Rene, Bob, and Oliver for the clarification. Being very much aware that the symbol names will become file names down the path, it looks like it is best to avoid % in the symbol name even if allowed in Windows, especially since it is also used as a code, (although I am not sure I understand where). I could foresee that if it started to cause trouble in one operative system or the other that it could become necessary to add it to the forbidden list down the path. As I am currently in good standing on this, there is no reason introduce risks now. I seem to end up with the 1% resistors where precision is not needed at lowest price point anyway, I might just continue leave it out for them, and just keep it in where precision is required. This will also make the precision resistors stand out in the list. The use of the Tol designation instead of appending the unit might be a good idea; another is of course to shorten percent to perc, but I am not sure I like the latter.

1 Like