Problem with displaying unicode symbols

0 views
Skip to first unread message

Alexey Karakulov

unread,
Sep 21, 2010, 10:34:03 AM9/21/10
to Haskell Charts
When I do something like

ghci> let myPlot = layout1_title ^= "My title: йцукен" $
defaultLayout1 :: Layout1 () ()
ghci> renderableToWindow (toRenderable myPlot) 300 300

I got ugly text in picture, like "My title: 9FC:5=".

My system is linux with en_US.utf8 locale, so it shouldn't be encoding
problem.

Alexey Khudyakov

unread,
Sep 22, 2010, 11:21:50 AM9/22/10
to haskell...@googlegroups.com
On 21.09.2010 18:34, Alexey Karakulov wrote:
> When I do something like
>
> ghci> let myPlot = layout1_title ^= "My title: О©╫О©╫О©╫О©╫О©╫О©╫" $

> defaultLayout1 :: Layout1 () ()
> ghci> renderableToWindow (toRenderable myPlot) 300 300
>
> I got ugly text in picture, like "My title: 9FC:5=".
>
> My system is linux with en_US.utf8 locale, so it shouldn't be encoding
> problem.
>
It is encoding problem. Chars are somewhere truncated to bytes without
proper encoding

> map (chr . (`mod` 256) . ord) "My title: О©╫О©╫О©╫О©╫О©╫О©╫"
> "My title: 9FC:5="

Tim Docker

unread,
Sep 26, 2010, 10:08:20 AM9/26/10
to haskell...@googlegroups.com
Hi,

On 21.09.2010 18:34, Alexey Karakulov wrote:
>> When I do something like
>>
>> ghci> let myPlot = layout1_title ^= "My title: О©╫О©╫О©╫О©╫О©╫О©╫" $
>> defaultLayout1 :: Layout1 () ()
>> ghci> renderableToWindow (toRenderable myPlot) 300 300
>>
>> I got ugly text in picture, like "My title: 9FC:5=".
>>
>> My system is linux with en_US.utf8 locale, so it shouldn't be encoding
>> problem.
>>

I suspect this has something to do with the "simple" API provided by
cairo for rendering text. I'll take a look at what's involved in the
more extensive text API in the next few days.

Tim

Reply all
Reply to author
Forward
0 new messages