HTTP and character encodings

Christian Maeder Christian.Maeder at
Wed Sep 12 12:09:23 CEST 2012

Am 11.09.2012 19:38, schrieb Ganesh Sittampalam:
> On 11/09/2012 09:30, Christian Maeder wrote:
>> Am 11.09.2012 00:22, schrieb Ganesh Sittampalam:
>>> Hi,
>>> tl;dr: I'd like to remove the String instances from the HTTP package.
>>> The HTTP library is overloaded on the type for request and response
>>> bodies; there are instances for String and both strict and lazy
>>> Bytestrings.
>>> Unfortunately, the String instance is rather broken. A String ought to
>>> represent Unicode data, but the HTTP wire format is bytes, and HTTP
>>> makes no attempt to handle encoding.
>> if you remove the String instance I would need to encode my strings
>> manually (and maybe worse than it is done now).
> The obvious way to encode them is to use ByteString.Char8.pack which is
> exactly what HTTP does now. I can't really think of anything worse that
> someone might do by accident.

My main use-case is simpleHTTP that is bound to the String instance, 
currently. There are no such short-cuts for byte-strings, are there?

I'ld suggest to make a proper byte-string interface first and then 
deprecate the String stuff.

(before calling Char8.pack, strings could be checked or filtered for 

Cheers Christian

More information about the Libraries mailing list