How to force UTF-8 encoding in browser?

I have page which encoding is declared with

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

But when I enter the page another encoding (ISO) is chosen in browser. I have tried to set encoding by PHP method

header('Content-type: text/html; charset=utf-8');

But it also didn’t help. All source files are encoded in UTF-8 without BOM. The only solution which I tried and it had worked was setting encoding in .htaccess file by adding AddDefaultCharset UTF-8 line, but then another pages on the server were not displayed correctly. How can I solve this problem?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Disable default charset:

AddDefaultCharset Off

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply