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 trialBraydan Willrath
Courses Plus Student 900 PointsW3 Validator Error
I've built my website following along very carefully to the videos but I get an error when validating my website through validator.w3.org and I don't understand why.
Error Line 7, Column 141: Bad value http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,800|Nova+Square for attribute href on element link: Illegal character in query: not a URL code point. ā¦:400italic,700italic,400,700,800|Nova+Square' rel='stylesheet' type='text/css'> Syntax of IRI reference: Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.
3 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Braydan,
The vertical bar |
in the google fonts url is an unsafe character and should be url encoded.
Replace it with %7C
Esteban Valdez
Front End Web Development Techdegree Student 8,858 PointsI had the same problem and believe it may just be an error with the copy/paste that you do into the validator. I think that your code is actually probably tip top. So don't stress it. =)
Braydan Willrath
Courses Plus Student 900 PointsSo that came direct from Google when i used their fonts directory
Jason Anello
Courses Plus Student 94,610 PointsYes, you didn't do anything wrong. I believe the validator was updated since the time Nick recorded the video and so we don't see the error in the video. Now the validator catches it and all you need to do is url encode that character.
It would be better if google just supplied us with the url and the %7C
was already in place. For now you have to go through that extra step.
This blog post contains a table which lists out all the unsafe characters, among other things. http://perishablepress.com/stop-using-unsafe-characters-in-urls/
It also tells you whether you need to encode each category or not.
Here's another link that has some tables for what the codes are. http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
There you can see that the vertical bar, or pipe character, is %7C
iain saunders
9,531 Pointsiain saunders
9,531 PointsI found that by entering the URL here:
http://www.w3schools.com/tags/ref_urlencode.asp
easier than scanning through and finding the errors yourself, especially when trying to learn from the beginning.