-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
Response with Text type does not contain unicode characters #263
Comments
Can you paste the result of |
|
@przembot Could you please try the master/HEAD version of servant (You'll need to change EitherT to ExceptT, or coerce it) with this patch applied?
|
@christian-marie The header is fine with this patch, but it breaks many tests in servant-server. |
Right. I just want to confirm that it is the browser trying to interpret Unicode as latin-1 |
@przembot with this patch does it render correctly for you? It wasn't quite clear from your response. |
@christian-marie Yes, it renders correctly with it :) |
I thought
|
Perhaps we should |
I use this code to override the Content-Type by replacing the headers of servant through wai-middleware. This will probably break all kinds of things if you need other content-types than UTF8 application/json, but it works for me :-)
Example usage (key point is just to use it as a Wai middleware):
Again, it's by no means meant as a good fix, and might cause problems in your app! |
We ran into this recently.
There's nothing inherently wrong with doing that apart from it being a redundant instruction given RFC4627 § 3. All we're saying is "yes, we are indeed following the default encoding". (Edited: mistaken Ctrl+Enter seems to submit) |
Just another two cents: The Chromium bug dates from Dec 2014 and not yet fixed. So... just tested using BrowserStack. |
@haskell-servant/maintainers Do we want to do something like:
To prevent more innocents being confused, or is this going to set the world on fire? |
How that patch affect the input, i.e. when the content body is sent with |
@christian-marie yes, that's what we want. But tests fail with that change - is anyone up for looking into why? |
It'd just be because extra headers are appearing, I'd think. I never actually saw them. I'll take a look within the next week, unless someone beats me to it. |
By the way, many content types could be generalized a bit. We could have a, say, |
@alpmestan: I wouldn't recommend complicating things for a feature that nobody is asking for. |
It seems like the most natural solution, because right now we have some "implicit" UTF8 charsets sprinkled over our content types and I've always found this to be unfortunate. We could still just export UTF8 versions by default and have the fancier ones sit in another module. Or maybe something like having all (textual content types) be UTF8 by default and then have something like: data Charset (charset :: Symbol) ct
instance (KnownSymbol charset, Accept ct) => Accept (Charset charset ct) where ... This would provide us with a somewhat principled approach for setting charsets: UTF8 by default for all textual CTs, use a little utility type to change it. |
Sorry, I dropped this on the floor. I'm gonna leave it there for now, really busy lately. |
Looks like both the Chromium and Firefox bugs have been fixed, which I think means even browsers agree with us not going against the spec here (and leaving things as they are) |
As in title, when connecting to the /test endpoint using web browser, the unicode characters are not displayed as they should.
Tested with Firefox 42.0, Chromium 46.0:
The text was updated successfully, but these errors were encountered: