<div class="gmail_quote">On Wed, Nov 3, 2010 at 9:00 AM, Simon Marlow <span dir="ltr">&lt;<a href="mailto:marlowsd@gmail.com">marlowsd@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On 03/11/2010 10:36, Bulat Ziganshin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Max,<br>
<br>
Wednesday, November 3, 2010, 1:26:50 PM, you wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1. You need to use &quot;chcp 65001&quot; to set the console code page to UTF8<br>
2. It is very likely that your Windows console won&#39;t have the fonts<br>
required to actually make sense of the output. Pipe the output to<br>
foo.txt. If you open this file in notepad you will see the correct<br>
characters show up.<br>
</blockquote>
<br>
it will work even without chcp. afaik nor ghc nor windows adjusts text<br>
being output to current console codepage<br>
</blockquote>
<br></div>
GHC certainly does.  We use GetConsoleCP() when deciding what code page to use by default - see libraries/base/GHC/IO/Encoding/CodePage.hs.<br></blockquote><div><br></div><div><br></div><div>This can actually be quite helpful. I&#39;ve discovered that if you have a console set to code page 65001 (UTF-8) and use WriteConsoleA (the non-wide version) with UTF-8 encoded strings, the console displays the text properly!</div>

<div><br></div><div>So the solution seems to be, when outputting to a utf8 console use WriteConsoleA.</div></div><br clear="all">David<div><br>-- <br>David Sankel<br>Sankel Software<br><a href="http://www.sankelsoftware.com">www.sankelsoftware.com</a><br>

585 617 4748 (Office)<br>
</div>