Checking for Coding Errors

I am trying to check my site, Building Strong Families National Seminars, responsible parenting,parenting webinars,bullying conference,bullying conferences,bullying games for kids,bullying games,bullying role plays, for coding errors using [url=http://validator.w3.org]The W3C Markup Validation Service. However, this site states the following:


No Character Encoding Found! Falling back to windows-1252.

None of the standards sources gave any information on the character encoding labeling for this document. Without encoding information it is impossible to reliably validate the document. As a fallback solution, the “windows-1252” encoding was used to read the content and attempt to perform the validation, but this is likely to fail for all non-trivial documents.

Before defaulting to windows-1252 the validator also tried to read the content with the following encoding(s), without success: UTF-8.

Read the FAQ entry on character encoding for more details and pointers on how to fix this problem with your document.

No Character encoding declared at document level

No character encoding information was found within the document, either in an HTML meta element or an XML declaration. It is often recommended to declare the character encoding in the document itself, especially if there is a chance that the document will be read from or saved to disk, CD, etc.

See this tutorial on character encoding for techniques and explanations.

I read through the tutorial yet I cannot figure out how to add the necessary coding needed for this site to check for errors. If someone could help me with this, I would surely appreciate it. Thanks.

Try adding this to the head section:

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

Thank you for your response. I just added your recommendation to the meta section on http://www.strongfamilies.us/participantreg.php:

<title>The “Standing Up To Bullying” Conference</title>
<meta name=“description” content=“Introducing the latest research, this bullying conference is designed to empower educators with skills to eradicate school bullying and violence.”>
<meta http-equiv=“Content-type” content=“text/html; charset=utf-8” />
<meta name=“keywords” content=…

and I got ‘Sorry! This document can not be checked’ when checking errors with The W3C Markup Validation Service.

More specifically, I am getting the following error code: Sorry, I am unable to validate this document because on line 230 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.
The error was: utf8 “\x94” does not map to Unicode.

I have no idea what this means. Please advice. Thank you.

First I’ll say the advice from TheRaptor is generally correct: the validator expects you to have a meta tag stating both the MIME type of the document (text/html) and the character encoding.

But it does get more complicated than that. The example given to you by TheRaptor is the same I use, but… and this is a big butt… my documents are also saved as UTF-8. This is important.

Originally, the validator told you it was going to assume your page was windows-1252. It probably saw something in your document that’s special to that Windows version of Latin-1 (ISO 8859-1). Mostly, those two are the same, but there is a range of characters where the Windows version is different (0x80 - 0x9F) and so your x94 is one of those.
Usually those characters are the " and ’ type.

Also in play is how your hosting server is sending the page out. While browsers are generally ok being given a page that’s really Windows-1252 but told by the meta tag that it’s Latin-1, if the server says for example that the page is UTF-8, then there’s a problem. Whatever the server says is supposed to override what the meta tag in the page says. Which means the browser is told to read the page however the server says, and this won’t work very well if the page simply wasn’t created and saved that way.

So first things first: what program are you writing your code in? If you’ve got magical curly word-processing quotes “like this” instead of “like this”, you might be using the wrong program for the job. You always want the straight, non-curved quotes ". Never let a program like Word get any say in an HTML, CSS or Javascript document.

Second: somewhere in the program you’re using, there’s an option in the menu talking about charsets. Somewhere there’s a place where you can choose HOW to save the document. Find it and see how it was saving it (prolly as 1252 but who knows).

Third: decide which you want to use. To see how your server is serving the page, at least in Firefox (I dunno in other browsers) go try to view the page, then hit CTRL-i. Or right-click on it and choose “view page info”. One of those should list how the server is sending your page. If you can’t change server settings, you could make sure your document is being saved the same way the server is sending it. Or, you could try what’s preferred: save as UTF-8 (not Unicode, do not add a BOM and uncheck any options than mention adding a BOM), and possibly your server will send the document out as UTF-8 too, which would make them match.

When the server and how the document was saved match, set your meta tag to list whichever charset you’ve chosen. So, all three should match. Browsers get happy.

Also, you’ll probably want that meta tag to be one of the first meta tags in the <head>. Once a browser sees confirmation of the charset, it will go back to the beginning and re-read the code. So have it do that as soon as possible.
(I got the above advice from Joel on Software about half-way down)

As a complete aside … wow, what a <title> tag! If I’d been having any doubts about whether to click on your site or someone else’s on the search results, that would send me running a mile. It just looks so over-eager and spammy. I’m not saying that your site is over-eager and spammy, but that’s the impression that a keyword-stuffed title tag gives.

Poes has already given you the gen on why you probably shouldn’t be saying it’s UTF-8, but another point to note is the order of the meta tags. You’re only allowed to use ASCII characters up until the point where you declare the charset, so it’s good practice to always put the content-type/charset tag second in the <head>, immediately after the title. It isn’t a problem here because you have only got ASCII chars there, but if you get into the habit of putting the charset first then it will avoid problems if you ever do have more exotic characters there.

I found the right character code to use that The W3C Markup Validation Service accepts. However, it seems that this site is giving me a lot of false negative readings. It lists about 114 errors on one page. Many of the errors have to do with the use of < and >. When I remove either of these characters, the whole page goes high-wire. I’m really confused about this validation site!

Thank you for response. Can you please give me the site address to the TheRaptor? I searched the Internet but I couldn’t find it. Thanks.

What do you mean, “site address to TheRaptor”? :slight_smile: Your site could have 114 errors, but fixing one of them could easily fix quite a few of the rest. Usually one error will cause a bunch down the line.

Did you actually get the page to validate properly now? When I try to validate your site its throwing the same “No Character Encoding Found” error?

The problem is that you have an HTML doctype (a very outdated one, too, as “transitional” is only for very old websites) but you are using XHTML syntax, ending a lot of your tags with [COLOR="Red"]/[/COLOR][COLOR="Blue"]>[/COLOR]. In HTML, that ending should just be [COLOR="Blue"]>[/COLOR]. E.g. instead of

<meta name="google-site-verification" content="google site verification code there" [COLOR="Red"]/>[/COLOR]

is should be

<meta name="google-site-verification" content="google site verification code there" [COLOR="Red"]>[/COLOR]

Thank you for your response. Which doctype should I use?

Always use Strict ones. Since you are using HTML 4.01, perhaps go for this one:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Can you please give me the site address to the TheRaptor? I searched the Internet but I couldn’t find it.

I was referring to the person in this thread who posted the response about adding the meta tag :slight_smile: