To show or not to show french accents

Max Kirillov max630 at mail.ru
Thu Dec 18 06:37:56 EST 2003


On Tue, Dec 16, 2003 at 07:49:26AM +0100, francis.girard at free.fr wrote:
> Good morning,
> 
> The following haskell program :
> 
> --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> module Main where
> 
> accentLetters :: String
> accentLetters = "ИЮТ"
> 
> main :: IO ()
> main = do putStr (show accentLetters)
> -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> after being compiled will give the result :
> 
> "\233\224\244"
> 
> But, exactly the same program, without the "show" function will give the result:
> 
> ИЮТ
>
> Is there some way to have "show" show all the printable characters, even those
> represented by a value greater than the US-ASCII 7 bits (127) ?
> 

The specific octet may be printable character or not depending on your
charset. For instance, your letters are printable in koi8-r (showing
upper Russian I YU T), but not in cp866 (al least recode cp866..koi8-r
fails on them).

The "show" function represents your over-127 bytes in portable and
readable (by read) way and, I think, it does right.

-- 
Max


More information about the Glasgow-haskell-users mailing list