Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell: Converting between ByteStrings and different text encodings

I'd like to translate between Strings and ByteStrings using various encodings.

I know there is the utf8-string package which handles the UTF8 encoding. However, there are a lot of other encodings described in System.IO.

I also see the Data.Text package which can translate between String, Text and ByteString using different encodings.

What's the most appropriate way to translate between String and ByteString using the various encodings?

like image 239
romul Avatar asked Mar 27 '11 16:03

romul


1 Answers

  • The straightforward way: http://hackage.haskell.org/package/encoding
  • Via iconv bindings: http://hackage.haskell.org/package/iconv-0.4.0.2
  • Via icu bindings: http://hackage.haskell.org/package/text-icu
like image 111
sclv Avatar answered Oct 23 '22 03:10

sclv