Discussion:
Mismatched Character Encloding
(too old to reply)
Tom Ferguson
2005-10-17 22:18:46 UTC
Permalink
The W3C XHTML validator is throwing a brand new "warning" at me. It still says
the page is "valid", the site "looks/works" correct. I'm just
confused/concerned at the warning. All of a sudden all of my pages, even a near
blank page stright out of Dreamweaver File>New>Basic page is getting this
"warning":

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

An example of a really empty page:
http://www.ferguson-photo-design.com/untitled.html

The validator:
http://validator.w3.org/

The page data:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Un</title>
</head>

<body>
Test
</body>
</html>

The only thing "I" have changed is a new web host. I moved from Earthlink to
MediaTemple. Any thoughts?
Tom Ferguson
2005-10-18 01:04:59 UTC
Permalink
I'll answer some of this myself (I think). I think I'm dealing with a host that
is declairing a specific character encoding (UTF-8) that conflicts with the
standard encoding that my version of Dreamweaver includes (iso-8859-1).
Assuming I've understood this, should I:

1) Change all of my existing pages by simply rewriting the meta tag from
iso-8859-1 to UTF-8 and change my Dreamweaver New Document Prefference to UTF-8?

2) Do something more than above to "convert" my pages from iso-8859-1 to UTF-8?

3) Ignore the whole thing because it isn't important?

A helpful site at:
http://linuxquality.dotsrc.org/articles/validationtest/

Said This:
"From time to time you may post this page to a hosting service only to find
that the W3C Validator gives you the following warning message:

Warning: Character Encoding mismatch! The character encoding specified in the
HTTP header (something) is different from the one specified in the META element
(iso-8859-1). I will use something for this validation.
Loosely speaking, the character encoding is the set of data values used to
represent the alphabet that a text document is written in. There are a variety
of character encodings available, such as US-ASCII and utf-8 (a form of
Unicode). Different character encodings make it more or less convenient to
represent the alphabets of all the different human languages on the web.

The original of this document declares that is it encoded in ISO-8859-1 by
using a <meta> element in the header of its HTML document:

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

Declaration of a document's character encoding is needed so web browsers know
how to display the text correctly. The page might be written in English,
French, Russian or Japanese - each language uses a different alphabet, and
there are a variety of character encodings that will serve to represent them.

The <meta> declaration is required when posting the page on most web sites
because those sites' web servers do not declare a character encoding explicitly
in the HTTP headers. However, some web servers do provide an explicit character
encoding, and a server provides one, it might conflict with the one declared in
the <meta> element. This may confuse both web browsers and validators.

What you should do in that case is either remove the explicit <meta> element
character encoding declaration from your copy of the document, or change it to
match the character encoding declared in the web server's HTTP headers. This is
more likely to be important if you translate this document to a different
language."
Michael Fesser
2005-10-18 19:35:54 UTC
Permalink
.oO(Tom Ferguson)
Post by Tom Ferguson
I'll answer some of this myself (I think). I think I'm dealing with a host that
is declairing a specific character encoding (UTF-8) that conflicts with the
standard encoding that my version of Dreamweaver includes (iso-8859-1).
Exactly. A HEAD-request to the server (can be done with command line
tools or <http://web-sniffer.net> for example) reveals the following
line in the response header that is sent from the server back to the
browser:

Content-Type: text/html; charset=UTF-8
Post by Tom Ferguson
1) Change all of my existing pages by simply rewriting the meta tag from
iso-8859-1 to UTF-8 and change my Dreamweaver New Document Prefference to UTF-8?
2) Do something more than above to "convert" my pages from iso-8859-1 to UTF-8?
Just changing a 'meta' information doesn't change the document's
encoding. You would have to save all documents again with UTF-8.
Post by Tom Ferguson
3) Ignore the whole thing because it isn't important?
It's an inconsistency that shouldn't be there. It might not be that
important, but I consider it a bug. You should fix it.

There's another option:

4) Alter the server configuration to set the default encoding to Latin-1
(ISO-8859-1). Since you're on an Apache server you can do this rather
easily with a .htaccess file in your site's root folder if your host
allowes that (a good host does), for example with an 'AddCharset'
directive.

AddCharset Directive
http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addcharset
Post by Tom Ferguson
http://linuxquality.dotsrc.org/articles/validationtest/
[...]
The <meta> declaration is required when posting the page on most web sites
because those sites' web servers do not declare a character encoding explicitly
in the HTTP headers.
A properly configured server _always_ sends the used encoding in its
response header. IMHO the 'meta' element is only useful for locally
stored documents, in the WWW it's rather pointless. Even if US-ASCII is
contained in most encodings, using the 'meta' element is still something
like "decode the document to see how to decode it". Hen and egg. Stupid.

Micha
Tom Ferguson
2005-10-18 23:07:21 UTC
Permalink
Thanks Michael for the responce. I will probably add an htaccess file and
command as it sounds easier than converting the whole site.

But, for curiousity sake... how do you (can you) convert from ISO-8859-1 to
UTF-8 in Dreamweaver MX-2004?

Thanks,
Tom
Tom Ferguson
2005-10-28 16:26:48 UTC
Permalink
The .htacce file did the trick :-)

Also, in case anyone finds this thread in a search, Dreamweaver will convert
pages from iso-8859-1 to UTF-8. Just go to Modify>Page Properties>Encoding

If you are working on pages from a template, you may need to update the
template rather than the individual pages.

Loading...