Webserver overriding page encoding?
After much struggling, a kind soul helped me realize that it's not Apache overriding the charset in the header but PHP itself.
Adding
header('Content-Type: text/html; charset=windows-1255');
to the top of the PHP file fixed the problem.
As far as I understand the chain is as follows:
- By default, Apache sends the content with a UTF-8 header
- If another charset is set in .htaccess, the browser accepts it
- Then comes PHP and forces the charset in the header as specified by default_charset in php.ini
Anything you define before the page reaches the browser in ignored.