E
E
evg_962017-10-03 23:15:45
Haskell
evg_96, 2017-10-03 23:15:45

How to output russian characters in haskell?

There is a sequence of commands.
But characters are displayed in ascii, how to encode them into utf-8 so that Russian characters are displayed?

let nouns = ["бродяга", "лягушатник", "поп"]

let adjs = ["ленивый", "ворчливый", "хитрый"]

[adj ++ " " ++ noun | adj <- adjs, noun <- nouns]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Moseychuk, 2017-10-04
@evg_96

That's the way it should be. It's unicode, print/show will escape it. Your unicode should be output correctly via putStrLn.
Try:

sequence_ $ map putStrLn [adj ++ " " ++ noun | adj <- adjs, noun <- nouns]

If you want to output unescaped unicode via print/show then check out this package https://hackage.haskell.org/package/unicode-show

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question