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?
because you didn't use cyrillic. Many distribution kits of Linux writes a garbage by default in the terminal instead of cyrillic chars. – Andrey Bushman Dec 23 '14 at 11:58