-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String instance is broken with non-ASCII data #28
Comments
Ideally I think the Content-Encoding and Content-Length headers should be set by the HTTP implementation, which would give the String instance liberty to default to something like UTF-8 (modulo user configuration perhaps). Alternatively, I would just delete the String instance and bump the version number. Applications that rely on this instance should really be fixed to do their own encoding, just recently I had the pleasure of figuring out what was causing package CouchDB to break - it was the broken String instance in here. If I see a String instance like that I'll assume it's sane - as in actually handles all valid Strings appropriately. |
I agree in principle that a broken String instance shouldn't exist, it's just that removing it now could have a very substantial impact and I'm scared of doing that. On the other hand there is all the time people like you will have wasted figuring out the brokenness. As well as dealing with the sending aspect, don't we need to deal with any encoding the server chooses to return? |
I'm in favour of doing |
I've spent a while investigating and I currently think doing String properly is too hard :-( I guess removing the String instance is the only remaining option. http://www.haskell.org/pipermail/libraries/2012-September/018426.html |
You are right that if the library is handed content that does not have a Since in practice encodings are sometimes detected from the actual content itself (XML declarations, meta tags), there is in fact no sane simplifying assumption if Long live |
+1 for moving to Another option is I was really dismayed, on my very first HTTP attempt, to find that the
According to the MIME spec, content without |
Sorry, I was hoping to do this much more promptly. It's a bit harder than I thought to do nicely because the entire library is based around using Strings :-( |
Although the package works with String, and indeed encourages its use by having that be the default type in some of the API helper functions, the handling of non-ASCII data is completely broken. We should be doing encoding properly to be consistent with the Content-Type header, both when sending and receiving.
This has been reported by a couple of users so far and is clearly pretty nasty, but I don't think it's trivial to fix because presumably the receiving and sending sides can use different encodings and when sending requests we ought to be optionally giving the user control of the encoding.
The alternative of removing the String instances completely is likely to be very disruptive so I don't think it's a reasonable option.
The text was updated successfully, but these errors were encountered: