Thank you for the further tips.<br>The root of my problem, the reason I decided to use that text-format library though, is because I thought Text.Printf is mangling unicode characters because it&#39;s working on String and not on Data.Text.<br>
However I realized now that even using text-format the unicode characters were still not written correctly in the file (well there was an error saving the file, invalid character, same as with Text.Printf). And I found the correct fix: I must add:<br>
<br>    hSetEncoding fileH utf8<br><br>After opening the file and before writing it in. If I do that, the unicode characters are written OK, and even if I use the usual Text.Printf (and even on windows - on linux where the locale is anyway utf8 it was working from the start). So now I&#39;m wondering should I even use text-format since after all Text.Printf does the job? The author of text-format claims it&#39;s written more efficiently but then again I don&#39;t believe there is any kind of bottleneck there.<br>
<br>Emmanuel<br><br><div class="gmail_quote">On Sun, Oct 21, 2012 at 10:24 AM, Daniel Trstenjak <span dir="ltr">&lt;<a href="mailto:daniel.trstenjak@gmail.com" target="_blank">daniel.trstenjak@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"><br>
On Sat, Oct 20, 2012 at 10:34:27PM +0200, Daniel Trstenjak wrote:<br>
&gt; The issue arises, because Text and a type of the Json library you&#39;re<br>
&gt; using, both have an instance for the type class IsString, which is<br>
&gt; the base for the OverloadedStrings extension.<br>
<br>
</div>Well, now I didn&#39;t read the error message properly. You have been<br>
absolutely right with your analysis.<br>
<div class="im"><br>
&gt; Instead of giving each element a type you could give the whole list a type:<br>
&gt; [&quot;a&quot;, &quot;b&quot;] :: [T.Text]<br>
<br>
</div>Or you could add a helper function:<br>
<br>
hprintT :: (MonadIO m) =&gt; Handle -&gt; TF.Format -&gt; [T.Text] -&gt; m ()<br>
hprintT = TF.hprint<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
Greetings,<br>
Daniel<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br>