Skip to content
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

Fix IE bug with decoding json response without encoding. #785

Merged
merged 2 commits into from Apr 22, 2015

Conversation

kak-tus
Copy link
Contributor

@kak-tus kak-tus commented Apr 20, 2015

IE 7,8,9 has bug with decoding of json response without encoding.
See http://stackoverflow.com/questions/8481453/jquery-ajax-request-doesnt-success-with-json-on-ie

The default encoding of application/json is UTF-8.
http://www.ietf.org/rfc/rfc4627.txt

That means, we can specify encoding in response without any trouble.

@Grinnz
Copy link
Contributor

Grinnz commented Apr 20, 2015

+1, this is one of the the first things I set in most projects anyway.

@jberger
Copy link
Member

jberger commented Apr 20, 2015

For what its worth, I'm happy that @kak-tus made the appropriate fixes for the tests and made a complete proposal. In isolation I would say sure, but I worry that this might need to be treated as a breaking change. My concern is for things like

$t->header_is('Content Type', 'application/json')

Which will suddenly start failing for people.

@kraih
Copy link
Member

kraih commented Apr 20, 2015

The list of MIME types in Mojolicious::Types has not been updated.

@kak-tus
Copy link
Contributor Author

kak-tus commented Apr 20, 2015

@jberger Another variant is to do something like this for json renderer

$self->res->headers->content_encoding('utf-8');

May be it more safely.

@kraih
Copy link
Member

kraih commented Apr 22, 2015

I'll give this a 👍, since all commonly used REST APIs i've tested appear to be using application/json;charset=UTF-8.

@jhthorsen
Copy link
Member

👍 I don't have any good reasons for my thumb up, other than serving json as anything else than UTF-8 isn't something I do.

kraih added a commit that referenced this pull request Apr 22, 2015
Fix IE bug with decoding json response without encoding.
@kraih kraih merged commit 050606c into mojolicious:master Apr 22, 2015
@kak-tus kak-tus deleted the ie_json_res_encode_fix_2 branch April 22, 2015 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants