Simple code below does not work correctly in Windows terminal with UTF-8 characters, whether with getLine/putStrLn from Prelude or from Data.Text.IO:
main = forever $ getLine >>= putStrLn
It echoes utf-8 characters during the input, then it prints "?"s in place of utf-8 characters; switching encoding with chcp 65001
makes them spaces.
I've downloaded the new terminal and enabled utf-8 support as this page suggested, but it had no effect.
This explanation seems related, but the solution proposed there does not work (the code does the same).
Apparently python has a similar issue
Is there any library/workaround that would work with GHC 8.x?
Please help!
EDIT: after more investigation, the problem is during the input as well - if instead of putStrLn I print character codes with mapM_ (print . ord) s
they are all either 63 without changing encoding or 0 after chcp 65001
.
hSetEncoding stdin utf8
does not help