Summary: | JSON displayed with wrong encoding when loaded in a frame (browser default instead of UTF-8) | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Sébastien Deleuze <sdeleuze> | ||||
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | NEW --- | ||||||
Severity: | Normal | CC: | ap, beidson, keith_miller, mmaxfield, saam, webkit, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | Safari Technology Preview | ||||||
Hardware: | iPhone / iPad | ||||||
OS: | iOS 12 | ||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=66056 | ||||||
Attachments: |
|
Description
Sébastien Deleuze
2019-04-29 08:55:20 PDT
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. *** Bug 251871 has been marked as a duplicate of this bug. *** |