6 replies [Last post]
co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 49 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

One thing I've not understood (or not really bothered getting around to researching if truth be told :roll: ) is the character encoding mismatch I often get when validating against XHTML (in this case 1.1, thanks to a friendly push from Stu Wink ). The mismatch does not stop code validating, but is a warning.

How does this occur? To the best of my knowledge, the HTML code only specifies utf-8. Where does the HTTP header info come from? (The server?) Here's the warning (which I'm sure you've come across yourselves from time-to-time)...

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

... just to inform you, I use BBEdit on OS X, and have had issues with it's encoding settings in the past.

The next sentence is true. The previous sentence is false. Discuss...

Tags:
ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 4 years 20 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

XHTML Validation encoding query...

Hi

What validator do you use?

Mine always seems to pass:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>New document</title>
</head>
<body>
<div>hello</div>
</body>
</html>

or this for 1.1 (slightly different html header, lang tag not allowed):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>New document</title>
</head>
<body>
<div>hello</div>
</body>
</html>

Just checked both to make sure Laughing out loud

How does yours differ?

Trevor

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 49 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

XHTML Validation encoding query...

The same on both. I've had this on XHTML Transitional as well. So, I'm reckoning it's either something to do with BBEdit's native file encoding, or a configuration in my Apache server.

The next sentence is true. The previous sentence is false. Discuss...

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 4 years 20 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

XHTML Validation encoding query...

MMM

Makes me glad all over to have a PC.

I use WebCoder v4 (soon to be v5 [beta out in a few days]) which is by far the best coding package I have used, and it's free.

I used to use Arachnophilia (which is java-based) but my main machine refuses point blank to allow Sun Java to install or run. It (like WebCoder) uses HTML Tidy, which (at least on my machine) doesn't like xhtml 1.1

Ah well, I now only use the online validator!

Trevor

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 49 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

XHTML Validation encoding query...

ClevaTreva wrote:

Makes me glad all over to have a PC.

I'll ignore that comment :roll: Wink

I do have a PC as well (one with Linux and one with XP Pro for a current ASP.NET job)... I use NoteTab Pro on Windows, which is okay. I may try your software suggestion though. However, you will not pry me away from my precious Mac for less than 99.5% of my work Wink

The next sentence is true. The previous sentence is false. Discuss...

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 49 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

XHTML Validation encoding query...

I've found the problem. It was the configuration of the Apache server. A simple fix to my httpd.conf file fixed it (it was default to ISO-blah blah rather than UTF-8). All is now cured. Smile

The next sentence is true. The previous sentence is false. Discuss...

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 49 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

XHTML Validation encoding query...

Thanks for Web Coder tip Trev! A fantastic application (been using it all week).

The next sentence is true. The previous sentence is false. Discuss...