My website has pages and other content with UTF-8 encoding. For HTML, setting the encoding in a meta tag is no problem. However, I also have raw text files with UTF-8 encoding that aren't displayed correctly, such as ⨯ appearing as ×. I've considered adding a byte-order mark at the start of such files, but I'd prefer not to since they aren't always well supported. I followed the instructions in this other question, but it had no effect. This is the HTTP response header:
HTTP/1.1 200 OK
Date: Sat, 12 Aug 2017 15:41:04 GMT
Server: Apache/2.4.10 (Debian)
Last-Modified: Wed, 09 Aug 2017 19:24:33 GMT
ETag: "c04c-5565707a34966"
Accept-Ranges: bytes
Content-Length: 49228
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
I was hoping to see Content-Type: text/plain; charset=utf-8. How can I get reliable UTF-8 encoding for these URIs?
AddType, since Apache won't send a Content-Type if it doesn't recognise the type, andAddDefaultCharset/AddCharset/etc are then irrelevant. You should unaccept the accepted answer, which is wrong, and add your own answer. – EML Jan 28 '20 at 10:21AddDefaultCharset utf-8is already in the Apache config for most or all recent releases, but you do need to check that it's there, and add it if not. I saidAddTypeis the right answer because Apache has no idea what to do without it, and it will probably just work with it (ie. if there's already anAddDefaultCharset). Up to you what to do, but anybody coming here for an answer has to read all the comments and make the connections from the missing content-type. – EML Jan 29 '20 at 17:51