Hey, I am one of the committer of Spring Framework working on our web support (Spring MVC) and we would like to stop specifying artificially UTF-8 charset for JSON (with "application/json;charset=utf-8", see https://github.com/spring-projects/spring-framework/issues/22788 for more details) since per spec "application/json" does not support charset parameter (https://tools.ietf.org/html/rfc7159#section-11) and UTF-8 should be used by default (https://tools.ietf.org/html/rfc8259#section-8.1). This very annoying bug has been fixed in September 2017 in Chrome (see https://bugs.chromium.org/p/chromium/issues/detail?id=438464) and Firefox renders as well correctly special characters with "application/json" so Safari is the last big player to not handling that correctly. To reproduce the bug, as described in the Chrome issue please compare rendering of http://thax.hardliners.org/issue438464.php?json=1 with Firefox, Chrome and Safari. Firefox and Safari render correctly the special characters while Safari does not. Thanks in advance for your help on this issue.
Small mistake in previous comment, you should read "Firefox and Chrome render correctly the special characters while Safari does not".
In my testing, loading the link via XMLHttpRequest does default to application/json, it's only loading into mail frame that uses default encoding. Which is arguably inconsistent, but not very much so, as the content is handled as text/plain in this case. Is loading JSON into the main frame something that Spring MVC does? Or is there some other scenario where a real website or framework is affected? <meta charset="windows-1251"> <script> var x = new XMLHttpRequest; x.open("GET", "http://thax.hardliners.org/issue438464.php?json=1"); x.onload = function() { alert(x.response); } x.send(); </script>
Created attachment 368473 [details] Requesting directly an application/json endpoint
Happy to hear that the main use case (XMLHttpRequest) is working correctly, that will allow us to move forward and switch back on "application/json". Thanks for checking. My laptop is under Linux so I used Safari on my iPhone to test and when I request directly an "application/json" endpoint, broken encoding is displayed as shown in the attached screenshot. Same endpoint with "application/json;charset=utf-8" is displayed correctly in the main frame. That's said, current behavior is likely to be confusing for a lot of web developers and is not consistent ("application/json;charset=utf-8" is displayed correctly), so I hope it will be fixed in a future release of Safari.
<rdar://problem/71522231>
*** Bug 251871 has been marked as a duplicate of this bug. ***