Forum Moderators: open

Message Too Old, No Replies

Character Encoding mismatch!

         

tarr74

4:04 pm on Jan 19, 2008 (gmt 0)

10+ Year Member



Hi,
the w3c validator validates my HTML 4.01 Strict, but it gives me a warning:

The character encoding specified in the HTTP header (iso-8859-1) is different from the value in the <meta> element (utf-8). I will use the value from the HTTP header (iso-8859-1) for this validation.

these are the first lines of my page:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MY TITLE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Where does the "value from the HTTP header (iso-8859-1)" come from?
Ah, I am writing in Italian and i nedd the accented wovels like "è" and "à". What character encoding should I use?

tedster

7:03 pm on Jan 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The http header is sent by your server, it's not on the page. The error message is just describing a conflict between what the server is declaring and what your page says.

Either character set can represent Western European characters, but the server header and the on-page meta tag should be in agreement for best results. When they are not in agreement, the http header from the server takes precendence.

Whichever charset you use, make sure that your authoring software is saving your document with the right encoding. My guess in your situation is that you are not actually saving your content in UTF-8, and that browsers are listening to the server headers at any rate. So just changing your charset meta tag is all you need to do.

Here are some pages from the W3C that get into more detail:

Server setup

How to make the server send out appropriate 'charset' information depends on the server. You will need the appropriate administrative rights to be able to change server settings...[instructions for various servers follows]

[w3.org...]

...conforming user agents must observe the following priorities when determining a document's character encoding (from highest priority to lowest):

1. An HTTP "charset" parameter in a "Content-Type" field.
2. A META declaration with "http-equiv" set to "Content-Type" and a value set for "charset".
3. The charset attribute set on an element that designates an external resource.

[w3.org...]

g1smd

10:06 pm on Jan 20, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Get the Live HTTP Headers extension for Mozilla Seamonkey or Mozilla Firefox and explore the headers that your server sends out. It is a whole new world.

getxb

4:06 pm on Jan 24, 2008 (gmt 0)

10+ Year Member



With the help of Licve HTTP Headers I checked the encoding of this page and it said:

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Does this mean that this page supports both ISO-8859-1 as well as UTF-8?

g1smd

12:39 am on Jan 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's what the browser sent out in the request.

Look at the next block for the server response.