Re: [Haskell-cafe] Getting a string from url-converted UTF8 input
On Sun, May 16, 2010 at 06:55:33PM +0200, Daniel Fischer wrote: Is there any problem compiling from source on FreeBSD? Well, good question :) After I tried to find some sources, I realized that there are http://www.haskell.org/ghc/download_ghc_6_12_2.html#freebsd -- Eugene N Dzhurinsky pgpy69yloZfQp.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Getting a string from url-converted UTF8 input
Hello all! Can somebody please explain wha am I doing in wrong way? === module UrlEncode where import System import Codec.Binary.UTF8.String as SU import Codec.Binary.Url as U import Data.Maybe main :: IO () main = do args - getArgs processWithArgs args processWithArgs (-d:[]) = getLine = putStrLn . maybe SU.decode . U.decode processWithArgs (-e:[]) = getLine = putStrLn . U.encode . SU.encode processWithArgs _ = putStrLn Usage: -e (encode) or -d (decode) === With this script if fed with input: === 1%29%20%D0%B3%D0%B4%D0%B5%20%D0%BD%D1%8B%D0%BD%D1%87%D0%B5%20%D0%BC%D0%BE%D0%B4%D0%BD%D0%BE%20%D0%B1%D1%80%D0%B0%D1%82%D1%8C%20%D0%BA%D0%BD%D0%B8%D0%B6%D0%BA%D0%B8%20%D0%B2%20%D0%B2%D0%B8%D0%B4%D0%B5%20FB2%3F%0D%0A%0D%0A2%29%20%D0%BA%D0%B0%D0%BA%D0%BE%D0%B9%20%D0%B5%D1%81%D1%82%D1%8C%20%D1%81%D0%BE%D1%84%D1%82%20%D0%BD%D0%B0%20%D0%B6%D0%B5%D0%BB%D0%B5%D0%B7%D0%BA%D1%83%20%D1%82%D0%B8%D0%BF%D0%B0%20%D1%82%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%20%D1%81%20Symbian === I am getting the output: === 1) 345 =K=G5 4= 1...@0bl :=86:8 2 2845 FB2? 2) :0:9 5ABL ADB =0 65;57:C B8?0 B5;5D= A Symbian === which is wrong. So what do I miss in encoding the data in UTF? Thank you in advance! -- Eugene Dzhurinsky pgpUPu4ndYSxU.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Getting a string from url-converted UTF8 input
* Eugene Dzhurinsky b...@redwerk.com [2010-05-16 18:42:08+0300] Hello all! Can somebody please explain wha am I doing in wrong way? [snip] I am getting the output: === 1) 345 =K=G5 4= 1...@0bl :=86:8 2 2845 FB2? 2) :0:9 5ABL ADB =0 65;57:C B8?0 B5;5D= A Symbian === which is wrong. So what do I miss in encoding the data in UTF? I assume you are using GHC 6.12. The trouble is in conversion done by putStrLn. Use one from System.IO.UTF8. Or try to upgrade to GHC 6.12 which respects the locale settings. -- Roman I. Cheplyaka :: http://ro-che.info/ Don't let school get in the way of your education. - Mark Twain ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Getting a string from url-converted UTF8 input
On Sun, May 16, 2010 at 06:56:58PM +0300, Roman Cheplyaka wrote: I assume you are using GHC 6.12. The trouble is in conversion done by putStrLn. Use one from System.IO.UTF8. Or try to upgrade to GHC 6.12 which respects the locale settings. Hello, Roman! Thank you very much for the hint, it really did help. Unfortunately, there's no port of GHC 6.12 available for FreeBSD now, so I used System.IO.UTF8 -- Eugene Dzhurinsky pgp4pa7EBeen7.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Getting a string from url-converted UTF8 input
On Sunday 16 May 2010 18:13:30, Eugene Dzhurinsky wrote: On Sun, May 16, 2010 at 06:56:58PM +0300, Roman Cheplyaka wrote: I assume you are using GHC 6.12. The trouble is in conversion done by putStrLn. Use one from System.IO.UTF8. Or try to upgrade to GHC 6.12 which respects the locale settings. Hello, Roman! Thank you very much for the hint, it really did help. Unfortunately, there's no port of GHC 6.12 available for FreeBSD now, so I used System.IO.UTF8 Is there any problem compiling from source on FreeBSD? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe