Post Go back to editing

special character (0xc2) in X<n> subcircuits

Category: Software
Product Number: ltspice
Software Version: 24.1.7

Hi,

this is on 24.1.0, 24.1.6 and 24.1.7 on linux under wine. I noticed something strange when adding components implemented as an X-prefix subcircuit, such as TRIAC, opamp, SCR.

I would expect a numeric suffix like 'X1' , X2 etc but instead seeing "X§U1" in the netlist :

* C:\users\q\Documents\LTspice\Draft1.asc
* Generated by LTspice 24.1.7 for Windows.
X§U1 NC_01 NC_02 NC_03 TRIAC
.backanno
.end

holy unicode, batman - that character between X and U is actually two bytes, 0xC2 0xA7. How did that get there ? Is anyone seeing this on windows too or is it some weird Wine interaction ?

  • Hi  ,

    I use Codeweavers Crossover (Wine) on my mac. I see those characters, too. Not a problem

    mike

  • Hi  ,

    From the help:

    LTspice can process three different encodings: Little-endian UTF-16 with or without byte order mark, UTF-8 with or without byte order mark, and Latin-1 (ISO 8859-1). Latin-1 encoding is only assumed if a file contains byte sequences that are invalid UTF-8. UTF-8 is the recommended encoding for LTspice, and is used exclusively by the built-in netlister. (Note: Non-ASCII netlists in UTF-8 encoding will not work as expected in older versions of LTspice that cannot decode UTF-8.) LTspice conforms to the Unicode standard version 14 and normalizes all its input. It compares text elements according to their canonical equivalence and uses Unicode case folding for case insensitivity. The LTspice netlist parser is based on grapheme clusters.

    mike

  • Yes, I have the same character on windows OS.

    I very often use the "view-->spice netlist" function to export spice netlist to other spice simulators, for example, hspice, pspice. This character is strange in these simulators.

    So I also hope Ltspice does not use this special character in netlist. Or is there any option in configuration to disable this character?

  • What's wrong with UTF-8? This is the year 2025. UTF-8 is more than 30 years old! It's the industry standard for encoding text, and for very good reasons.

    The § character has always been used by LTspice to adjust device prefixes.

    Best Regards,
    Mathias

  • Sorry for what I said, I didn't mean to complain about UTF-8. The image below is a scene where I use it for many years.
    (draw schematic by using LTspice-->export netlist-->copy netlist to Hspice sp file-->use Hspice to simulate schematic)
    The symbol(0xc2) in netlist exported in version 24.1.7 will be treated as a space when the Hspice is simulated,
    so Hspice will give an error message when calling the subcircuit. Actually, it's not a big problem either,
    I can replace this character with one editor to make Hspice emulation correctly.
    It's just that previous versions didn't have this problem, so this phenomenon is raised here.

  • If you only use ASCII otherwise, just run the netlist through a UTF-8 -> latin1 converter. Then it'll be like before.