[Haskell-cafe] Re: String vs ByteString
Florian Weimer
fw at deneb.enyo.de
Sat Aug 14 06:15:22 EDT 2010
* 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>
More information about the Haskell-Cafe
mailing list