borkdude / flycheck-clj-kondo

Emacs integration for clj-kondo via flycheck
94 stars 17 forks source link

Set the data encoding to/from clj-kondo to UTF-8 #17

Closed ikappaki closed 2 years ago

ikappaki commented 2 years ago

Hi,

could you please consider fix for issue with fly checking non ascii clojure code in Emacs. The code is likely to be converted to iso-8859-1, translate non-ascii chars to spaces and thus greatly confusing the linter. It fixes #16.

Although Emacs is primarily setup to to communicate in ASCII to and from the subprocesses it forks on both MS-Windows and GNU/Linux, the issue is more apparent on MS-Windows. This is because Linux is most likely to have set the locale to a UTF-8 codebase with one of the relevant environment variables, such as LANG=C.UTF-8, which Emacs honours and uses as the codepage encoding to communicate data with its subprocesses.

The solution is here a very simple one. Just set the comm codepage Emacs uses to communicate to the clj-kondo executable to UTF-8.

Since this is a tricky business to test and maintain the integrity of the setup, I took the opportunity to add some basic tests (hand picked from the clj-kondo corpus) for each of the available checkers, as well as integrate them with the GitHub CI, using the almighty Elisp Development Environment. I've also included a test to check the utf-8 condition. I hope you find it useful (I can of course revert if you think is too much).

All tests pass across Ubuntu, MS-Windows and MacOS.

Thanks

borkdude commented 2 years ago

This is awesome, thank you very much.