[Haskell-cafe] putStrLn "ß"

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Fri Aug 13 19:06:12 EDT 2010


"Henk-Jan van Tuyl" <hjgtuyl at chello.nl> writes:

> L.S.,
>
> When I try
>   putStrLn "ß"
> (Eszett (sharp S)) in WinGhci, the interpreter seems to have
> disappeared; ctrl-C gives the message "Interrupted" in a separate
> window, but no new  prompt.

That's weird; possibly an encoding problem>

> When I start GHCi in a shell, the interpreter displays:
>   Prelude> print "ß"
>   "\223"
>
> Is this a known issue?
>
> Other experiments with WinGhci:
>   >print "αγδ"
>   "a?d"
> (Trying to print alpha, gamma, delta.)
>
>   >print "β"
> (Trying to print beta) interpreter hangs again.
>
> Details:
>  - WinGhci 1.0.2
>  - GHCi, version 6.12.3
>  - Windows XP

This is an encoding problem; remember that "print = putStrLn . show", so
it escapes the String first (to a unicode code-point).

,----
| Prelude> print "ß"
| "\223"
| Prelude> putStrLn "ß"
| ß
`----

(running ghci within a terminal on a Linux-based box).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list