Strip a UTF-8 byte order mark at the start of a line -- i.e. at

the start of a file written by a Windows editor.  A BOM is never
legal SPICE syntax; left in place it glues to the first token
(fatal ".subckt/.ends mismatch" class errors in included libs).
This commit is contained in:
Peer Hofstra 2026-07-07 14:54:57 +02:00 committed by Holger Vogt
parent 10276f9936
commit 301051d1da
1 changed files with 7 additions and 0 deletions

View File

@ -1403,6 +1403,13 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name
continue; continue;
} }
/* Strip a UTF-8 byte order mark at the start of a line -- i.e. at
the start of a file written by a Windows editor. A BOM is never
legal SPICE syntax; left in place it glues to the first token
(fatal ".subckt/.ends mismatch" class errors in included libs). */
if (!intfile && strncmp(buffer, "\xEF\xBB\xBF", 3) == 0)
memmove(buffer, buffer + 3, strlen(buffer + 3) + 1);
/* OK -- now we have loaded the next line into 'buffer'. Process it. /* OK -- now we have loaded the next line into 'buffer'. Process it.
*/ */
if (first) { if (first) {