Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I recently <a href="http://illegalargumentexception.blogspot.com/2009/12/java-safe-character-handling-and-url.html#URI2009_URL_BUILDER" rel="noreferrer">wrote</a> a URL encoder, so this is pretty fresh in my mind.</p> <blockquote> <p><code>http://site/gwturl#user:45/comments</code></p> </blockquote> <p>All the characters in the <a href="http://tools.ietf.org/html/rfc3986#section-3.5" rel="noreferrer">fragment part</a> (<code>user:45/comments</code>) are perfectly legal for <a href="http://tools.ietf.org/html/rfc3986" rel="noreferrer">RFC 3986</a> URIs.</p> <p>The relevant parts of the <a href="http://tools.ietf.org/html/rfc3986#appendix-A" rel="noreferrer">ABNF</a>:</p> <pre><code>fragment = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" pct-encoded = "%" HEXDIG HEXDIG sub-delims = "!" / "$" / "&amp;" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" </code></pre> <p>Apart from these restrictions, the fragment part has no defined structure beyond the one your application gives it. <em>The scheme, http, only says that you don't send this part to the server.</em></p> <hr> <p>EDIT:</p> <p><strong>D'oh!</strong></p> <p>Despite my assertions about the URI spec, <a href="https://stackoverflow.com/users/218978/irreputable">irreputable</a> provides the correct answer when <a href="https://stackoverflow.com/questions/2053132/is-a-colon-safe-for-friendly-url-use/2053640#2053640">he points out</a> that <strong>the HTML 4 spec restricts element names/identifiers</strong>.</p> <p><em>Note that identifier rules are <a href="http://dev.w3.org/html5/spec/dom.html#concept-id" rel="noreferrer">changing in HTML 5</a>. URI restrictions will still apply (at time of writing, there are some unresolved issues around HTML 5's use of URIs).</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload