Char
is the type for Unicode characters in Haskell, and String
is simply [Char]
(i.e. a list of Char
items). Here is some simple code:
main = putStrLn "©" -- Unicode string
This code compiles fine, but I get the runtime exception when I run it in the PowerShel.exe or cmd.exe:
app.exe: : commitBuffer: invalid argument (invalid character)
Why does this happen? Weirdly enough, when I do the same in C#, I get no exception:
Console.WriteLine("©");
In .NET, chars are Unicode too. PowerShell or cmd prints c
instead ©
, but at least I get not exception. How can I get my Haskell executable to run smoothly?
"©"
fine but chokes with the same error on"ഠഃ അ ഠൃ ൩"
. – chichcp 65001
in the terminal -- all non ascii characters will be unreadable, though. – chichcp.com 65001
? – bheklilr