github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.11k stars 4.2k forks source link

Incorrect syntax-highlighting of XML files with BOM #6561

Closed mbtools closed 11 months ago

mbtools commented 11 months ago

Describe the bug

The <?xml ... > tag is not properly colored in some cases. The color of the last character in each attribute name is not correct. It seems the issues occur with XML files that include a byte-order-mark (BOM):

image

Example: https://github.com/github-linguist/linguist/blob/master/samples/XML/MDM.admx

Expected behaviour

Proper highlighting example (XML file without BOM):

image

Example: https://github.com/github-linguist/linguist/blob/master/samples/XML/Example.mdpolicy

XML Grammar

AFAIK, the XML grammar is not responsible for the handling the BOM. Ergo the issue in this repo.

lildude commented 11 months ago

This isn't specific to XML and isn't a Linguist or grammar issue. This is a problem with the highlighting engine or rendering of the results where the highlighting of the first line is shifted left by one char (possibly due to miscounting the BOM, but I'm not sure as I'm not familiar with this side of things)... this is easier to see with the l in xml and the last quote after 1.0. This has been noted for C++, VB.NET, and F# too in this discussion.

As in that case, please use the "Contact GitHub" link at the bottom of any page to report this to GitHub support who will be able to route this to the correct team. Feel free to reference this issue and the aforementioned discussion.

Closing as there's nothing Linguist can do about this.