How to tell the Browser the character encoding of a HTML website regardless of Server Content.-Type Headers?

Posted by hakre on Pro Webmasters See other posts from Pro Webmasters or by hakre
Published on 2012-10-19T11:06:31Z Indexed on 2012/10/19 11:26 UTC
Read the original article Hit count: 504

I have a HTML page that correctly (the encoding of the physical on disk matches it) announces it's Content-Type:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=utf-8">
    <title> ...

Opening the file from disk in browser (Google Chrome, Firefox) works fine.

Requesting it via HTTP, the webserver sends a different Content-Type header:

$ curl -I http:/example.com/file.html
HTTP/1.1 200 OK
Date: Fri, 19 Oct 2012 10:57:13 GMT
...
Content-Type: text/html; charset=ISO-8859-1

(see last line). The browser then uses ISO-8859-1 to display which is an unwanted result.

Is there a common way to override the server headers send to the browser from within the HTML document?

© Pro Webmasters or respective owner

Related posts about html

Related posts about browsers