I had an unusual issue while I was updating the MSDNAA site of our university: the pages rendered correctly when I opened them from my own computer, but not from the server. Almost all browsers displayed them perfectly, except Firefox that showed ugly characters instead of the special Hungarian accented chars.
I checked the files, all of them were saved correctly in UTF-8 with the byte-order-mark in the beginning – which was not hard to recognize thanks to Firefox that rendered them on the page: ï»¿
Because the site now consists of brand new HTML5 pages, all page contains the <meta charset="utf-8" /> line, but I also added the classic Content-Type line for sure – in vain.
After the quick checks, back to Rule #1: When in doubt, start Fiddler! Fiddler showed me the following header in the response:
Content-Type: text/html; charset=iso-8859-1
This was the moment when I understood why the old files were all saved in ISO-8859-1: because this header is forced by the webserver! And the setting in the header overwrites the setting in the page – at least in Firefox now.
Because the site runs on Apache in a shared hosting environment without ASP.NET, PHP or admin access, server side code was not an option to overwrite the header. None the less the final solution became quite simple. I just added this single line to the .htaccess file in the root of the site:
The settings in the root are applied to the subfolders as well.