[Haskell-cafe] Re: String vs ByteString
michael at snoyman.com
Wed Aug 18 23:00:31 EDT 2010
On Wed, Aug 18, 2010 at 11:58 PM, Johan Tibell <johan.tibell at gmail.com>wrote:
> As for blaze I'm not sure exactly how it deals with UTF-8 input. I tried to
> browse through the repo but could find that input ByteStrings are actually
> validated anywhere. If they're not it's a big generous to say that it deals
> with UTF-8 data, as it would really just be concatenating byte sequences,
> without validating them. We should ask Jasper about the current state.
As far as I can tell, Blaze *never* validates input ByteStrings. The
"proper" approach to inserting data into blaze is either via String or Text.
I requested that Jasper provide an unsafeByteString function in Blaze for
Hamlet's usage: Hamlet does the UTF-8 encoding at compile time and is able
to gain a little extra performance boost.
If you want to properly validate bytestrings before inputing them, I believe
the best approach would be to use utf8-string or text to read in the
bytestrings, but Jasper may have a better approach.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe