SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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 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.

  2. #2
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    Try adding this to the head section:
    Code:
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    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)

  5. #5
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by MarkStrobel3367 View Post
    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 The W3C Markup Validation Service.
    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.
    Quote Originally Posted by MarkStrobel3367 View Post
    <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" />
    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.

  6. #6
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!

  7. #7
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MarkStrobel3367 View Post
    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"? 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?

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,319
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by MarkStrobel3367 View Post
    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!
    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 />. In HTML, that ending should just be >. E.g. instead of

    Code:
    <meta name="google-site-verification" content="google site verification code there" />
    is should be

    Code:
    <meta name="google-site-verification" content="google site verification code there" >

  10. #10
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your response. Which doctype should I use?

  11. #11
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,319
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    Always use Strict ones. Since you are using HTML 4.01, perhaps go for this one:

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

  12. #12
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    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 :)


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •