Marker is in the wrong place when non-ASCII characters come earlier on the line (chktex counts bytes)
The marker is in the wrong place when a non-ASCII character comes earlier on the line: chktex reports the column as a UTF-8 byte offset, and the linter passes it on as a character column.
Reproduce (Sublime Text 4215 on Windows, SublimeLinter, SublimeLinter-chktex, chktex 1.7.10, default settings):
\documentclass{article}
\begin{document}
Café ééé "quoted" and $x$ here.
\end{document}
chktex -wall "-f%l:%c %k %k %n: %m\n" prints (the same format string the linter uses):
3:14 Warning Warning 18: Use either `` or '' as an alternative to `"'.
3:21 Warning Warning 18: Use either `` or '' as an alternative to `"'.
3:27 Warning Warning 46: Use \( ... \) instead of $ ... $.
On line 3 the first " is the 10th character, but chktex says column 14: é is 2 bytes in UTF-8 and there are four of them in front of it.
Actual (what SublimeLinter highlights on line 3):
| warning | should be on | is on |
|---|---|---|
18, first " (character 10) |
" |
ted |
18, second " (character 17) |
" |
d |
46, $ (character 23) |
$ |
here |
On lines where only ASCII comes before the problem the markers are right (for example This is "quoted" text. is marked on the "). The more accented characters before the problem (French, German, Spanish, Czech and so on), the further the marker drifts to the right.
Expected: the marker is on the character chktex complains about.
This is how chktex has always reported columns. The same effect is in other linters whose tools count bytes, for example SublimeLinter/SublimeLinter-cppcheck#25 and SublimeLinter-golint#9.
Possible fix: convert the column before it is used. In linter.py an override of split_match can take the line from self.view, decode the first col bytes (re-encoded as UTF-8) and use the number of characters; I have not changed any code.