4 ms·
There's one issue with text, it defaults to ASCII: > For example, for any MIME type whose main type is text, you can add the optional charset parameter to spec
by wiktor-k 3y ago
There's one issue with text, it defaults to ASCII:
> For example, for any MIME type whose main type is text, you can add the optional charset parameter to specify the character set used for the characters in the data. If no charset is specified, the default is ASCII (US-ASCII) unless overridden by the user agent's settings. To specify a UTF-8 text file, the MIME type text/plain;charset=UTF-8 is used.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_...
- paulddraper 3y agoMany text types default to other encodings. E.g. text/vcard https://www.iana.org/assignments/media-types/text/vcard https://www.iana.org/assignments/media-types/text/vcard
- arp242 3y agoThat's fine, no? Not like application/anything can default to the correct character set. This is why everyone typically uses application/json; charset=UTF-8.
- creatonez 3y agoIf you don't have a content type, you're screwed no matter what you do. Web browsers use a goofy detection system that sometimes works and sometimes fails, because it only reads the beginning of the file.