Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are URI's with a double hash (##) invalid?

I have URI that contains ## (e.g. http://foo.com/bar##baz) . Ruby's URI.parse function throws an error when I try to parse it.

Are double hash marks forbidden in URIs? Or is the Ruby Parser too strict?

like image 243
hamiltop Avatar asked Jun 11 '13 22:06

hamiltop


1 Answers

Fragment Identifiers may not contain a hash sign. The parser is correct.

The syntax for a fragment identifier is defined as follows:

fragment = *( pchar / "/" / "?" )

pchar is defined as:

pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

unreserved, pct-encoded and sub-delims are defined as:

unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

pct-encoded = "%" HEXDIG HEXDIG

sub-delims  = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
like image 142
Jörg W Mittag Avatar answered Sep 28 '22 16:09

Jörg W Mittag