Andrey Bushman
Andrey Bushman

Reputation: 12516

GHCi: incorrect text output despite the right font and codepage

Windows 8.1 x64 Russian.

I create and fill the %AppData%\ghc\ghci.conf file:

:! title GHCi (Haskell interpreter)
putStrLn $ replicate 30 '*'
putStrLn "© Андрей Бушман, 2014" -- The sample of some not English chars...
:set prompt "\x03BB: "

This file has the UTF-8 without BOM encoding. I run ghci via Cmd.exe and PowerShell.exe. I set necessary font and codepage before. But I get unexpected result: incorrect text output. Why I get it?

enter image description here

enter image description here

enter image description here

enter image description here

UPD

I can resave my ghci.conf file with Windows 1251 encoding and add the :! chcp 1251at first row:

:! chcp 1251
:! title GHCi (Haskell interpreter)
putStrLn $ replicate 30 '*'
putStrLn "© Андрей Бушман, 2014" -- The sample of not English chars...
:set prompt "\x03BB: "

Now I see the correct result:

enter image description here

But why it doesn't work when I save with UTF-8 or UTF-8 without BOM encodings and set 65001 codepage?

Also... I get incorrect text in the title when I use the cyrillic chars:

:! chcp 1251
-- Cyrillic in te title:
:! title GHCi (Интерпретатор Haskell)
putStrLn $ replicate 30 '*'
putStrLn "© Андрей Бушман, 2014 (\"авторские права\" на данное сообщение ;) )"
:set prompt "\x03BB: "

enter image description here

How can I fix it?

Upvotes: 2

Views: 308

Answers (1)

jurgenb
jurgenb

Reputation: 472

This is probably related to the following question: Unicode console I/O in Haskell on Windows

Btw, setting the font in the console will not affect what codepage is used.

Upvotes: 1

Related Questions