Forum Moderators: open

Message Too Old, No Replies

W3C validation error utf-8?

utf-8 and iso-8859-1

         

jack38

1:11 pm on Oct 17, 2005 (gmt 0)

10+ Year Member



Just validated a page and got this error:

"Character Encoding mismatch! 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.

This page is not Valid HTML 4.01 Transitional!"

Should I just use utf-8 in my meta tag to fix this? Will utf-8 affect my pages? the site is in English.

Here is how my document starts:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

Robin_reala

1:13 pm on Oct 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The big question is: what encoding format have you saved your page in? :) If it's UTF-8 then yes - change the meta tag. If it's ISO-8859-1 then adjust the server to output the correct header.

If you don't know what encoding format you're using then check the settings in your text editor. Ideally we'd all be using UTF-8 by now, but some programs still can't handle it.

encyclo

2:07 pm on Oct 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is most likely a server misconfiguration - the server should not be sending a default character encoding unless you specifically want to, as a character encoding defined in a HTTP header overrides the character encoding defined within a document, for example in a meta tag. If you are on a shared server, contact your hosting company. If it is a dedicated server, then check your server settings.

bedlam

9:42 pm on Oct 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just had to cope with this problem this morning on a server where I can't influence the http header directly.

If the page is a php page (the one I was working on was), you can do this:

<?php header("Content-type: text/css; charset: utf-8");?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

In this case, be sure to place the php code on the same line as the doctype declaration as I've done above - not to do so can cause some browsers to switch to quirks mode...

-B