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 trialmaya sophie
5,754 Pointsthe use of %20 !!! why we have to right down space using "%20" when we can simply let some space there ?
example: "Hi%There" vs "Hi There". Why do we have to use that sign? I tried both and the result is the same.Question: why do we have to complicate the situation with all kind of signs....amp&...etc
maya sophie
5,754 Pointswrite not right....still sick
1 Answer
Michael Hulet
47,913 PointsURLs are percent-escaped, which means that if there's a special character (like a space) which different browsers might interpret differently, you must replace them in the URL with these special percent sequences. For example, in Safari and Chrome on my machine, if I use just a normal space in a URL instead of %20
, it will interpret my entry as a Google Search and not actually take me to the website I was trying to go to. You can read more about percent encoding and find lots of common codes on its Wikipedia page
HTML entities like &
serve a very similar purpose in a different context. Many old browsers interpret HTML as ASCII, which has a very limited possible set of characters. An HTML entity is a sequence that represents a character that's not necessarily in the character encoding that the page uses. In most cases nowadays, you can type the character itself and all browsers will know what you mean just fine, but for the sake of correctness and supporting old browsers, it's good to use HTML entities instead of just the characters themselves. The W3C has a full list of possible HTML entities
maya sophie
5,754 Pointsmaya sophie
5,754 PointsI mean "write" not "wright"...I'm a bit sick..sorry