Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

HTML does not pass validation at W3C

I'm following along with the Website Testing video and my HTML generates errors when having it validated at http://validator.w3.org/check Nick's code looks exactly the same as mine yet in the video he passes validation. I'm getting the error on the line that adds the Google fonts:

Error Line 7, Column 142: Bad value http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,700italic,400,700,800 for attribute href on element link: Illegal character in query: not a URL code point.

Anyone else encounter this issue?

6 Answers

Yes, it's a pretty common issue. The simple solution is to replace the pipe symbol | with %7C. Below is a version of the code with the pipe character encoded.

<link href='http://fonts.googleapis.com/css?family=Changa+One%7COpen+Sans:400italic,700italic,400,700,800' rel='stylesheet' type='text/css'>
Chris Komaroff
Chris Komaroff
Courses Plus Student 14,198 Points

This seems to pass validator. Thanks! Now I see on google search that %7c seems to be an escape for pipe (|). Hello, Nick, you should bring this up in your video.

That worked!

Thank you.

No problem :smile:.

I had to figure this one out as well. Was a good learning experience, but I wonder if they would be able to include a note in the course materials referencing this, as the video seems to have been produced prior to this error becoming an issue.

I'm guessing that understanding what error outputs mean gets easier with experience, as that was more confusing that what the error actually was, if that makes sense.

Hey Sarah, there are actually some notes towards the bottom, but I don't think a solution was listed.

Validation Errors

You may encounter validation errors when using the W3C validators. For example, in this project, the vertical pipes in a Google Font URL ?might cause an error because they're not escaped using HTML entities. It's a good idea to fix as many errors as possible, because more errors can mean increasingly unpredictable cross-browser results.

Of course I missed that...thanks for pointing it out. Even more of a learning experience, I guess. Here's to hoping the noob mistakes are few and far between :)

Actually a lot of people missed that including myself! Part of the learning process I assume. :smiley:

By the way I saw you're in Portland. Sure wish I was there! Thought I might tell you about the Treehouse's Code Oregon project if you haven't already heard about it.

Oh, I'm part of the program, and VERY grateful and excited for it :)

I need to make a note to check the notes from now on!

Actually, I place more blame on Google here. You would think they of all people would generate code to include in our pages that would pass W3C HTML5 validation. I was also mildly annoyed that the W3C error didn't tell me which character was illegal (unless I missed that as well - perhaps I should have counted to character 142?).

I've got a LOT left to learn, but I took a Java class somewhat recently and found that you begin to develop a knack for what error messages mean and where to start looking for what to fix. And that I learned more from the frustration of figuring it out on my own than from getting it right the first go-around.

Validation is an often debated subject but it appears to be getting better and it's generally more accepted that validation is a good thing. The W3.org website does not pass its own jigsaw validation service and Google explains why it does not validate so there are actually many reasons why validation is not always a priority.