This is my page header:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
...
As you can see the charset is set to utf-8 but Chrome/Firefox does not print the page as utf-8. I guess that is because the server sends this header:
Content-Type:text/html; charset=ISO-8859-15
How can I overwrite this header from my html page?
You can't.
HTTP headers have priority over meta elements that claim to be equivalent.
Fix your server settings so it sends the correct content-type.
You can't overwrite the charset from your html page. Things to look for:
Your web server may be configured with a default charset. See if you can change it. Be warned: this may be a global setting that would affect all files of a specific Content-Type
.
Despite the fact that you've literally typed charset=UTF-8
into your html document, your IDE/text editor may still be saving it with a different character encoding. If your using *nix, you can check the file encoding on any file on the command line like this:
file -I filename.html
If the output of that command reports something other than UTF-8
or us-ascii
, you should go back to your IDE/text editor and figure out how to set the character encoding on the files it saves as UTF-8
. Your web server may be auto detecting the character encoding and setting headers accordingly.
You can change the server header by adding an .htaccess file containing:
AddDefaultCharset UTF-8