When running the following code
do line <- getLine
putStrLn line
or,
getLine >>= putStrLn
And, after
getLine >>= putStrLn
entering
µ
one encounters this output:
⠀
Now, I already tried chcp 65001
beforehand, which doesn't work, and the encoding of stdin
is utf8
.
An examination without putStrLn
shows:
getLine
µ
'\NIL'
My environment:
Windows 10 Version 10.0.17134 Build 17134
Lenovo ideapad 510-15IKB
BIOS Version LENOVO 3JCN30WW
GHCi v 8.2.2
How can this be solved?
EDIT: Specifically, the following sequence of actions causes this:
- Open
cmd
- Type
chcp 65001
- Type
ghci
- Type
getLine >>= putStrLn
- Type
µ
However, the following does not:
- Search for
ghci
- Open
ghci.exe
at%PROGRAMS%\Haskell Platform\8.2.2\bin
- Repeat 4-5.
NOTE: %PROGRAMS%
is not a real environment variable.
EDIT: As requested, the output of GHC.IO.Encoding.getLocaleEncoding
:
UTF-8
Also, the output of System.IO.hGetEncoding stdin
:
Just UTF-8
(when using chcp 65001
)
EDIT: The character is U+00B5. I am using a German keyboard, system locale Germany, language setting English, Keyboard language ENG with German layout.