Fork me on GitHub
#leiningen
<
2020-02-17
>
Keith16:02:31

I asked this question on an old git issue, but I figured I'd ask here as well. We ran into a situation where unicode characters that were being used in unit tests were causing tests to fail on Windows, but succeed on macOS. Upon further investigation, the default charset on macOS is UTF-8:

(java.nio.charset.Charset/defaultCharset)
=> #object[sun.nio.cs.UTF_8 0x78e00c34 "UTF-8"]
But the default charset on Windows is windows-1252:
(java.nio.charset.Charset/defaultCharset)
=> #object[sun.nio.cs.MS1252 0x136e5c2e "windows-1252"]
This issue appears to have solved this problem for macOS by modifying the script that launches lein (https://github.com/technomancy/leiningen/commit/efc8fb4424d23ed19552999e9ddcc8be125dec03), but that same change doesn't seem to have been made to the batch file that launches lein on Windows (https://github.com/technomancy/leiningen/blob/master/bin/lein.bat#L402-L405). After adding another line in lein.bat for -Dfile.encoding="UTF-8" ^, the default charset on Windows is now UTF-8:
(java.nio.charset.Charset/defaultCharset)
=> #object[sun.nio.cs.UTF_8 0x4c663894 "UTF-8"]

Keith18:02:35

Asked on freenode