Created attachment 464889 [details] Screenshot demonstrating Safari's behaviour with and without ;charset=utf-8 Hi! According to section 8 of RFC 8259[1], all JSON documents must be encoded using UTF-8 / Unicode. If a JSON file is accessed directly within Safari (for example, an API endpoint is accessed), it uses the browser's default encoding (for me, it defaulted to `Western (ISO Latin 1)` to render it. This can lead to garbled text; I discovered this as an API endpoint I created contains two emoji characters which did not render correctly within Safari. In Chrome, it renders fine. If the `Content-Type` HTTP header is set to `application/json;charset=utf-8`, it works fine in Safari. However, the inclusion of this is widely discouraged[2][3]. Not only that, IANA specifically call out that there is no `charset` parameter defined for the `application/json` media type[4]. So WebKit should automatically assume that `application/json` is in UTF-8 and render it as such. Otherwise, there will be more people who fall down a rabbit hole trying to work out what they've done wrong with character encoding when writing an API endpoint whilst using Safari! [1] https://datatracker.ietf.org/doc/html/rfc8259#section-8 [2] https://github.com/request/request/issues/383 [3] https://stackoverflow.com/questions/70250068/with-fastapi-how-to-add-charset-to-content-type-media-type-on-request-header#:~:text=Short%20answer,not%20be%20necessary. [4] https://www.iana.org/assignments/media-types/application/json
I may have misread #197369 as being about how JSON is processed in XMLHTTPRequests and/or iFrames but it seems it is a duplicate to a degree. Will leave as is currently though so maintainers can assess whether they're different at all.
I think that it's an exact duplicate. *** This bug has been marked as a duplicate of bug 197369 ***