Recently I have started a web project to learn haskell.When deal with some non-English character,e.g Chinese character “中文”. I notice when I use function like show
or print
,it will only output its unicode value,instead of the character itself:
GHCi, version 9.2.8: https://www.haskell.org/ghc/ :? for help
ghci> putStrLn "中文"
中文
ghci> show "中文"
"\"\\20013\\25991\""
ghci> print txt
"\20013\25991"
ghci> putStrLn $ show "中文"
"\20013\25991"
(Above code also represent the same as the compiled Haskell program)
It seems like the function like show
or print
deal with Show
able cannot deal with non-English character.Is this a bug or shortage of Haskell?If not,can someone give me any advice to deal with non-English character?
(this is a noob question,I’m so sorry