How to convert Unicode Escape Sequence to Unicode String in Haskell -
I have prelude & gt; PutStrLn "\ 3619 \ 3657 \ 3634 \ 3609 \ 3648 \ 3592 \ 3657 \ 3648 \ 3621 \ 3657 \ 3591"> a £ ¹ ?? ¸ ² ¸ ¸¸¸¸ ?? A ?? Ah ?? Note: You do not actually have the string Prelude & gt; "¸ £ ¹ ?? ¸² ¸ ¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸ ?? ¸¸¸ ?? ¤ ?? ¤ ?? ¥ ๠?? ภ??" "3619 \ 3657 \ 3634 \ 3609 \; On the other hand, the If you are actually reading a string that prevents a file or something, you can simply read : prelude & gt; S & lt; One - ??? GetLine "3619 \ 3657 \ 3634 \ 3609 \ 3648 \ 3592 \ 3657 \ 3648 \ 3621 \ 3657 \ 3591 " which I want to decode it. I tried searching the Unicode library without success.
"\ 3619 \ 3657 \ 3634 \ 3609 \ 3648 \ 3592 \ 3657 \ 3648 \ 3621 \ 3657 \ 3591" - Instead, you have the UTF-32 string Is
responsive ?? Responsible ?? A.K. ?? ¸ à ¥ ๠?? Ah ?? , for which
"\ 3619 \ 3657 ..." is an ASCII-compliant literal By default, show
example to display GHCI results , Which does not do much to show things can be used as the Haskell code for words In the case of Unicode, it is conservative because this is the reason
putStrLn ,
putChar , code> hPutStr In -8 will dump the string instead of an ASCII-protected representation.
"3619 \ 3657 \ 3634 \ 3609 \ 3648 \ 3592 \ 3657 \ 3648 \ 3621 \ 3657 \ 3591"
Prelude & gt; S "" \\ \\ 3619 \\ 3657 \\ 3634 \\ 3609 \\ 3648 \\ 3592 \\ 3657 \\ 3648 \ 3621 \ \ 3657 \ "3591 \" "<<"> - - Note double escaping, because I am showing a string in which the string is literal.
Prelude & gt; PutStrLn $ s read? / Blockquote>
Comments
Post a Comment