-
Notifications
You must be signed in to change notification settings - Fork 17
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
writeJSON is not UTF-8 compliant #5
Comments
Ah, weird. Couple of questions:
|
Hi Oz, again let me elaborate on this and I will get back to you. I can reply to 3) straight away:
I'll get back later to you with points 1 and 2. |
@adinapoli any update on this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If we write an instance of a
ToJSON
data type usingwriteJSON
, it doesn't handle correctly utf-8 text with contains accented letters. This is an excerpt of an italian text, with the current function:The problem is twofold:
a) We need to encode using not the standard
encode
function, but the one insideData.Aeson.Encode
b) We need to set the
charset=utf-8
encoding inside the HTTP header.This is the proposed patch:
where
AE.encode
is a qualified import ofData.Aeson.Encode
.With the proposed patch, everything works as expected:
I also suggest we refactor out the
modifyResponse
, maybe creating a combinator which adds the charset utf8 ad the content-type, so that we can reuse what we already have :jsResponse
,jsonResponse
etc.A.
The text was updated successfully, but these errors were encountered: