[Haskell-cafe] Re: String vs ByteString

Johan Tibell johan.tibell at gmail.com
Sat Aug 14 06:27:01 EDT 2010


On Sat, Aug 14, 2010 at 12:15 PM, Florian Weimer <fw at deneb.enyo.de> wrote:

> * Bryan O'Sullivan:
>
> > If you know it's text and not binary data you are working with, you
> should
> > still use Data.Text. There are a few good reasons.
> >
> >    1. The API is more correct. For instance, if you use Text.toUpper on a
> >    string containing latin1 "ß" (eszett, sharp S), you'll get the
> >    two-character sequence "SS", which is correct. Using Char8.map
> Char.toUpper
> >    here gives the wrong answer.
>
> Data.Text ist still incorrect for some scripts:
>
> $ LANG=tr_TR.UTF-8 ghci
> GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Prelude> import Data.Text
> Prelude Data.Text> toUpper $ pack "i"
> Loading package array-0.3.0.0 ... linking ... done.
> Loading package containers-0.3.0.0 ... linking ... done.
> Loading package deepseq-1.1.0.0 ... linking ... done.
> Loading package bytestring-0.9.1.5 ... linking ... done.
> Loading package text-0.7.2.1 ... linking ... done.
> "I"
> Prelude Data.Text>


Yes. We need locale support for that one. I think Bryan is planning to add
it.

-- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100814/b844d0e4/attachment.html


More information about the Haskell-Cafe mailing list