haskell: output non-ascii characters

試著忘記壹切 提交于 2019-12-08 18:35:15

问题


I'd like to output non-ascii characters in WinGHCi, but this is what I get:

Prelude> "δ"
"\948"
Prelude> putStr "\948"
*** Exception: <stdout>: hPutChar: invalid argument (character is not in the code page)

I am using WinGHCi 7.0.3 on windows xp. What do I have to do so that WinGHCi prints a nice little delta?


回答1:


Works on OSX!

Prelude> putStrLn "\948"
δ

Sounds like this is a windows problem with nothing to do with haskell...




回答2:


This is a WinGHCI bug. Use GHCI (the console, non-GUI version).

UPD: this is apparently not entirely correct (works for me with Greek letters and not e.g. Cyrillic).



来源:https://stackoverflow.com/questions/7511393/haskell-output-non-ascii-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!