How to "show" a utf8 string?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to "show" a utf8 string?

Magicloud Magiclouds
Hi,
  I am using LDAP hackage to do some ldap searching. I am not sure if
this is its problem. All Chinese chars returned like "\29579".
  How to convert it to the actual Chinese char? I thought it was my
terminal's fault, so tried to use System.IO.UTF8 to put the result
into a file and viewed by firefox, no luck.
--
竹密岂妨流水过
山高哪阻野云飞

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to "show" a utf8 string?

Roel van Dijk-3
Have you tried using putStrLn?

Small GHCI example:

  Prelude> putStrLn "\29579"
  王

I believe the Show instances for chars and strings escape all
characters with a codepoint > 127.

2012/1/10 Magicloud Magiclouds <[hidden email]>:

> Hi,
>  I am using LDAP hackage to do some ldap searching. I am not sure if
> this is its problem. All Chinese chars returned like "\29579".
>  How to convert it to the actual Chinese char? I thought it was my
> terminal's fault, so tried to use System.IO.UTF8 to put the result
> into a file and viewed by firefox, no luck.
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to "show" a utf8 string?

Felipe Lessa
In reply to this post by Magicloud Magiclouds
On Tue, Jan 10, 2012 at 7:55 AM, Magicloud Magiclouds
<[hidden email]> wrote:
> Hi,
>  I am using LDAP hackage to do some ldap searching. I am not sure if
> this is its problem. All Chinese chars returned like "\29579".
>  How to convert it to the actual Chinese char? I thought it was my
> terminal's fault, so tried to use System.IO.UTF8 to put the result
> into a file and viewed by firefox, no luck.

Are you using "print"?  Did you try "putStrLn"?

Cheers, =)

--
Felipe.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to "show" a utf8 string?

Magicloud Magiclouds
In reply to this post by Roel van Dijk-3
Thank you guys. I forgot the point that print involves show.

On Tue, Jan 10, 2012 at 6:27 PM, Roel van Dijk <[hidden email]> wrote:

> Have you tried using putStrLn?
>
> Small GHCI example:
>
>  Prelude> putStrLn "\29579"
>  王
>
> I believe the Show instances for chars and strings escape all
> characters with a codepoint > 127.
>
> 2012/1/10 Magicloud Magiclouds <[hidden email]>:
>> Hi,
>>  I am using LDAP hackage to do some ldap searching. I am not sure if
>> this is its problem. All Chinese chars returned like "\29579".
>>  How to convert it to the actual Chinese char? I thought it was my
>> terminal's fault, so tried to use System.IO.UTF8 to put the result
>> into a file and viewed by firefox, no luck.
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> [hidden email]
>> http://www.haskell.org/mailman/listinfo/haskell-cafe



--
竹密岂妨流水过
山高哪阻野云飞

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe