SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation xhtml validation help please newbie here

    ok i need to validate 3 pages on my website of 5 pages and i have validated 2 so far ok. i found that i am getting just a error that is stoping me from getting a full validation and that error stays the same on all three pages it states that-
    (No Character Encoding Found! Using utf-8.

    None of the standards sources gave any information on the character encoding labeling for this document. The character encoding utf-8, which you have chosen via the Encoding override option, will be used for tentative validation. )
    i have fixed 2 pages by placing this code in them within the head tag-

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

    but the other 3 pages will not validate with this tage and i am compleatly stuck. This is a project for school that is due in 3 days i need help on this asap please.
    my main site is benbernier. webs . c o m (sorry wouldent let me put it in properly becuase im new but it has the matrix theme on my home page so you know its the right one. and the pages that wont validate fully are my home page which contains some java scrip errors on top of it and my links page as well as my contact page please check this over and help me please im desprate!
    thank you all so much in advance.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,228
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    Hi tron86, welcome to the forums,

    If you're serving "real" XHTML -- you should make sure the server sends the charset in the content-type header i.e.
    Code:
    Content-Type: application/xhtml+xml; charset=utf-8
    and specify it in the XML declaration. i.e.
    Code HTML4Strict:
    <?xml version='1.0' encoding='utf-8'?>

    Do all 5 pages have the same DOCTYPE?

    BTW, for real XHTML the meta is
    Code HTML4Strict:
    <meta http-equiv='Content-Type' content='application/xhtml+xml; charset=utf-8' />

    Note* IE (<=6 at least) can't handle real XHTML (requires you to do doctype switching as a fix), so maybe you really do want fake XHTML.
    Quote Originally Posted by tron86
    but the other 3 pages will not validate with this tag
    What error(s) is it giving for those?

  3. #3
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes all pages have same doc type. if you would like to see the pages here is the web address but i need to put spaces between the .c o m becuase the forum wont let me add the whole thing in becuase im new or somthing. benbernier.webs. c o m the utf-8 code is a copy and paist i used from the validator and is the same on all pages in the same place as well. i just dont understand.also i did try editing the meta tag to the one you had on there and it didint work but i also have my doc type set as traditional 1.0 as well on all pages.
    Last edited by tron86; Feb 8, 2009 at 22:25. Reason: more information

  4. #4
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is still the error it gives me using the meta tag u gave me as well as using the one i had it was the same it is a tenitive code for all three pages. and the two pages that passes i used the meta tag and it fixed right away but it is still these three that are messed up - anyway this is the error code it gives me--
    No Character Encoding Found! Using utf-8.

    None of the standards sources gave any information on the character encoding labeling for this document. The character encoding utf-8, which you have chosen via the Encoding override option, will be used for tentative validation.

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,228
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    The 2 errors on that page are from the javascript tag. Where before this was good enough (still supported so works, but not valid)
    HTML Code:
    <script language="javascript">
    change it to
    HTML Code:
    <script type="text/javascript">
    and you'll be fine.

    The encoding warning is most like caused during copy/paste. If you look at view-source you'll see a "box" before
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    which is most likely the BOM (byte order mark) that some text editors insert. If you copy/paste using only a plain text editor (eg. Notepad not Word) you should be able to avoid this problem in the future.

    Compare with the bio page's view-source which doesn't have the box and does validate.

  6. #6
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i used notepad we are only aloud to use that for class. so do i need to deleat the doctype and re enter it by hand on these pages? will that fix it? well i will try and thanks for the javascrip error help that was my next question.

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,228
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    AFAIK, Notepad doesn't insert BOMs, but I have an old version so it might have an option for it somewhere now.

    Otherwise you may have copied it without realizing it since it's an "invisible" non-rendered character. If you delete everything before the first "<!" so there's no whitespace at all before it hopefully it won't be there when you save the page again. Otherwise try typing or pasting in the DOCTYPE again and save it. Making certain there's no whitespace before it.

  8. #8
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope same thing. there is no white space and i even eraced everything and enterd it in by hand both the new docktype code you gave me as well as the new meta tage but the error stayed the same.and i tryed changing the javascript to what you had put on there and it got rid of the javascrip when u look at the page.

  9. #9
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i have done everything in my power to make this work i got nothing someone please help get this thing to validate properly...im dieing here!

  10. #10
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Note that content (Media) type serving is not determined via the Meta tag but rather by the Server software configuration.

    The content entry is only the author's advisory notation and has no bearing on how the Markup is actually being served. As a matter of fact any text of the author's choosing can be used for content such as: <meta http-equiv="Content-type" content="GARBAGE;charset=utf-8" /> as has been done on this example page (check the source code) without affecting Validation or function.

    James
    Last edited by jamesicus; Feb 9, 2009 at 08:17. Reason: corrected URI

  11. #11
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so how do i get rid of my error that states --No Character Encoding Found! Falling back to UTF-8.

    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 "UTF-8" encoding was used to read the content and attempt to perform the validation, but this is likely to fail for all non-trivial documents.

  12. #12
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tron86 View Post
    so how do i get rid of my error that states --No Character Encoding Found! Falling back to UTF-8 ...........
    As has been pointed out, you do it either by designating the character encoding in the Prolog or the Meta tag. If you serve your XHTML as text/html (actually HTML) you will not want to use the Prolog as that will cause your page to render in Quirks mode in IE 6.0 Browsers -- serve it as application/xhtml+xml and it wont render/function in IE Browsers anyway -- so include it in a Meta tag:

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

    Read this W3C Character sets & encodings in XHTML, HTML and CSS Tutorial.

    James
    Last edited by jamesicus; Feb 9, 2009 at 00:42. Reason: added link

  13. #13
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have this already and still throws me a error this is the first part to my coding that has all this in it.
    <!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=utf-8" />

  14. #14
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by the way my site is benbernier.webs. c o m if you would like to check my code i am getting this error code on my home page as well as my links and contact pages.
    thanks again for the help i am learning alot and just need to get throught this final proscess for school. its much aprecheated

  15. #15
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tron86 View Post
    by the way my site is benbernier.webs. c o m if you would like to check my code i am getting this error code on my home page as well as my links and contact pages.
    thanks again for the help i am learning alot and just need to get throught this final proscess for school. its much aprecheated
    Aha, now we can get somewhere!

    In your header delete this:

    <html xmlns="http://www.w3.org/1999/xhtml" >

    Copy and paste this in its stead:

    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-us' lang='en-us'>

    You must designate the Document language.

    And don't use Transitional Doctypes -- that just lets you include deprecated Markup -- Strict is the way to go:

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>

    James
    Last edited by jamesicus; Feb 9, 2009 at 01:07. Reason: added info

  16. #16
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok that is now changed but i did not change to strick as of yet becuase when i tryed it it found alot more errors. do i need to change it to strict to make this validate properly?

  17. #17
    SitePoint Member tron86's Avatar
    Join Date
    Feb 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok just tryed the new <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-us' lang='en-us'>
    but still gave me the same validation error didint fix it. and i wasint taught as of yet how to use the strict so i dont know what to change all the mistakes to.ahh...idonno..

  18. #18
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ben:

    I checked your source code -- there was a hidden UTF (BOM) character before your DocType which caused the encoding error -- you also had an error with forgetting type="text/javascript" in a tag. It is too late at night for me to explain it all in detail -- I sent you the corrected code (validates as XHTML 1.0 Transitional) in an e-mail.

    BTW, Ben, although you specified Content Type as application/xhtml+xml in the Meta tag, it is actually being served as text/html -- the meta tag content designation is only informational, remember.

    James
    Last edited by jamesicus; Feb 9, 2009 at 13:45. Reason: corrected info

  19. #19
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
     is a UTF-8 signature (BOM) that is inserted by some text editors at the beginning of Markup coding (just preceding the Doctype) as a unicode description marker. If not removed, it will cause (for one thing) failed validation. Many text editors (Windows Notepad included) automatically add a UTF-8 (BOM) signature to all UTF-8 Documents which will result in automatic Browser rendering using that encoding.

    See W3C FAQ: Display problems caused by the UTF-8 BOM for information including removal procedures.

    James

  20. #20
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,228
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    This is a stubborn problem I see.

    When I make an HTTP request for the index page, the server returns this header
    Code:
    HTTP/1.x 200 OK
    Date: Mon, 09 Feb 2009 18:36:13 GMT
    Server: Apache/1.3.39 (Unix) mod_jk/1.2.26 mod_layout/3.2 mod_gzip/1.3.19.1a mod_throttle/3.1.2
    X-Powered-By: ModLayout/3.2
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html
    So the page is an HTML page that is coded in XHTML mark-up. This is far from uncommon. I wouldn't worry about that for now.

    When I look at view-source using Firefox, I don's see anything before the DOCTYPE. But if I copy it and paste it into Notepad, a "?" appears before it. I am certain this is a BOM problem. BOMs are important for UTF-16 and UTF-32 but some editor apps insert it for UTF-8 too. This is something the editor app does when you save the file.

    My version of Notepad (Windows98) shows BOMs as question marks. AFAIK Notepad for WindowsXP doesn't show them so you can't see if they're there or not. But, the WindowsXP version of Notepad has additional "Save As" settings. It seems that if you save the text file with the "UTF-8 encoding" the XP Notepad adds the BOM as a "signature". This is unnecessary and will cause you problems especially if you start including files inside of others. I don't have XP Notepad, so I can't say exactly what the Save-As sequence should be, but try saving it as "plain text" -- not UTF-8, re-upload and see if that helps.

    * For more BOM info see http://www.unicode.org/faq/utf_bom.html#BOM

  21. #21
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ben: I copied and pasted your source code into my HTML text editor and ran it through "Tidy" -- that is when I spotted the  UTF-8 signature (BOM) character ahead of the Doctype which I removed. I corrected the errors and validated the document. I have loaded the corrected document onto my server for testing with the following results:

    Page display (naturally without style sheet CSS)

    Validation result

    HTTP Header view

    James


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
  •