Jim Blackler
Jim Blackler

Reputation: 23169

Is it a standards breach to have unescaped href URIs in <a> links?

In a HTML 4.01 Transitional document, is it a breach of the standard to specify a link href without escaping space characters?

For instance this link

<a href="http://example.com/some page.html">Some page</a>

as opposed to

<a href="http://example.com/some%20page.html">Some page</a>

I can't easily work it out from http://www.w3.org/TR/html40/struct/links.html#h-12.1.3 , maybe one of you folks can enlighten?

Upvotes: 1

Views: 69

Answers (2)

Oded
Oded

Reputation: 498904

The href attribute value is a URI, as specified in RFC 2396.

Which says (section 2.4.3. Excluded US-ASCII Characters):

The space character is excluded because significant spaces may disappear and insignificant spaces may be introduced when URI are transcribed or typeset or subjected to the treatment of word- processing programs.

So, you must encode spaces.

Upvotes: 2

Quentin
Quentin

Reputation: 943108

In a HTML 4.01 Transitional document, is it a breach of the standard to specify a link href without escaping space characters?

Yes. The href attribute, takes a URI as defined in RFC1630, RFC1738 and RFC1808.

RFC1738 says:

The space character is unsafe because significant spaces may disappear and insignificant spaces may be introduced when URLs are transcribed or typeset or subjected to the treatment of word-processing programs.

and

All unsafe characters must always be encoded within a URL.

Upvotes: 3

Related Questions