[Haskell-cafe] Re: String vs ByteString

Donn Cave donn at avvanta.com
Fri Aug 13 11:57:43 EDT 2010


Quoth Sean Leather <leather at cs.uu.nl>,

> Which one do you use for strings in HTML or XML in which UTF-8 has become
> the commonly accepted standard encoding? It's text, not binary, so I should
> choose Data.Text. But isn't there a performance penalty for translating from
> Data.Text's internal 16-bit encoding to UTF-8?

Use both?

I am not familiar with Text, but UTF-8 is pretty awkward, and I will
sure look into Text before wasting any time trying to fine-tune my
ByteString handling for UTF-8.

But in practice only a fraction of my data input will be manipulated
in an encoding-sensitive context.  I'm thinking _all_ data is binary,
and accordingly all inputs are ByteString;  conversion to Text will
happen as needed for ... uh, wait, is there a conversion from
ByteString to Text?  Well, if not, no doubt that's coming.

	Donn Cave, donn at avvanta.com


More information about the Haskell-Cafe mailing list