12

Hyperlinks which contain any of the dollar symbol $, the asterisk symbol * or the apostrophe/single-quote symbol ' cause various things to break:

The [qux](http://...) and [qux][reference] syntaxes do produce valid URLs but unnecessarily percent-escape such characters (whereas they do not percent-escape some invalid characters, such as the double-quote symbol ").

In STD 66, the above characters are defined amongst the sub-delims grammar production:

sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="

And the pchar production makes clear that such characters are valid in path segments unencoded:

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

1 The post preview does not render any hyperlink at all for this case.

  • 1
    I can understand why this may be a problem in some very small edge cases - but how often does this really happen? – Richard J. Ross III Mar 16 '13 at 21:05
  • @RichardJ.RossIII: I only noticed it because it came up here. – eggyal Mar 16 '13 at 21:06
  • http://foo.com/~bar works! :D I use that one a lot... – animuson Mar 16 '13 at 21:08
  • * is going to break stuffs (note that it is used for italic, bold, italic bold, bullet point also) so I think it is reasonable not to support it. $ and ' are probably OK. – nhahtdh Mar 17 '13 at 23:30
  • @nhahtdh: $ is used for MathJax syntax on sites that have that enabled, like math.stackexchange.com. – Ilmari Karonen Mar 18 '13 at 1:26
  • 1
    @nhahtdh: + is also used for bullet points, but that works okay. Parsers should be able to determine the context and interpret symbols accordingly; I certainly cannot see any reason why the <a href="..">..</a> syntax should not support such symbols, even if there is some reason that other syntaxes cannot. In any event, it should fail more gracefully than it does in some of the above examples. – eggyal Mar 19 '13 at 10:47

You must log in to answer this question.

Browse other questions tagged .