Currently withUtf8 is not adding full utf-8 support on Windows, because we're not changing active codepage, and default one is not supporting utf-8 symbols.
Steps to reprouce:
Create a.hs with
import Main.Utf8
import System.IO.CodePage
main = do
withUtf8 $ putStrLn "\9920"
withUtf8 $ withCP65001 $ putStrLn "\9920"
withCP65001 $ putStrLn "\9920"
putStrLn "\9920"
and run it in cmd (my machine has Windows 10 installed).
Output is
?
⛀
⛀
a.hs: <stdout>: commitBuffer: invalid argument (invalid character)
so when default codepage is used, symbols are rendered as question marks.
When correct codepage is set, printing works with or without withUtf8
and when neither withCP65001 nor withUtf8 was used, there is error.
Suggestion
We can include withCP65001 to withUtf8. It makes printing user-friendly on Windows and does nothing on other systems.
Currently
withUtf8is not adding fullutf-8support on Windows, because we're not changing active codepage, and default one is not supporting utf-8 symbols.Steps to reprouce:
Create
a.hswithand run it in
cmd(my machine has Windows 10 installed).Output is
so when default codepage is used, symbols are rendered as question marks.
When correct codepage is set, printing works with or without
withUtf8and when neither
withCP65001norwithUtf8was used, there is error.Suggestion
We can include
withCP65001towithUtf8. It makes printing user-friendly on Windows and does nothing on other systems.