zls icon indicating copy to clipboard operation
zls copied to clipboard

Not handling UTF-8 BOM

Open marler8997 opened this issue 4 years ago • 3 comments

I've got some autogenerated Zig files that contain a UTF-8 BOM. The BOM for UTF-8 is 0xef 0xbb 0xbf (see https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8). It looks like this confuses ZLS because the syntax highlighting on these files is all messed up. ZLS can address this by detecting and ignoring the BOM.

marler8997 avatar Jan 24 '21 08:01 marler8997

Thanks for reporting, I will implement this soon.

alexnask avatar Jan 24 '21 10:01 alexnask

FYI, here's the code in the Zig compiler that handles the BOM (it's just one line of code): https://github.com/ziglang/zig/blob/fb37c1b0912c65d72b82f32df8bc7e780ab1ad80/lib/std/zig/tokenizer.zig#L342

marler8997 avatar Jan 28 '21 02:01 marler8997