# Markdown [link](url) syntax mangles colons in URLs

So, here's a long and ugly link to a program (from this answer):

The only problem is, that second link doesn't work. :-(

Why not? Because, apparently, if you use the nicer Markdown link syntax, the Stack Exchange Markdown parser insists on percent-encoding the colons (:) in the query parameters to %3A, and the Manufactoria program is not smart enough to decode them.

Admittedly, both programs are in violation of Postel's law ("Be conservative in what you send, and liberal in what you accept.") here, but the fact that a random Flash game is also buggy doesn't excuse not fixing bugs in Stack Exchange's Markdown parser.

Besides, it seems to me that the SE behavior doesn't violate just Postel's law (which, while a good principle to follow, is not an official standard), but also RFC 3986, which, in section 2.2, defines : as a "reserved character" and says:

"URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent. Percent-encoding a reserved character, or decoding a percent-encoded octet that corresponds to a reserved character, will change how the URI is interpreted by most applications."

Thus, strictly speaking, Manufactoria is perfectly within its rights in treating : and %3A as different characters in query strings (even if 99.9% of all other software on the web probably don't), whereas what Stack Exchange is doing by encoding colons in already-composed URIs is nor just pointless — it's also a plain violation of the relevant Internet standards.

-
Important question. Does it also do it if you use the [<link text>][<#>] ... [#]: <URL> syntax supported in posts or only in the [<link text>](<URL>) syntax supported in posts and comments? –  dmckee Feb 2 '14 at 15:06
@dmckee: It happens with both. In fact, I used the [text][#] syntax in the original answer where I first noticed the problem. –  Ilmari Karonen Feb 2 '14 at 17:27
Should this be migrated to meta.stackoverflow.com? –  Justin Feb 2 '14 at 23:47
@Quincunx: It would be on topic there, yes, given that the bug (presumably) exists on all SE sites. I figured I'd try reporting it here first, though, since the specific symptom I reported is probably fairly localized (not too many Manufactoria links on most SE sites, I'd guess), and since (AIUI) the devs do generally track bug reports on all metas. –  Ilmari Karonen Feb 2 '14 at 23:54

# Another bug

Markdown also mangles URLs in comments.

Here's an example. I posted a link to Wikimedia Commons with the following URL:

http://commons.wikimedia.org/wiki/File:Buket_and_spade_on_Killahoey_Strand_-_geograph.org.uk_-_1426946.jpg


Unfortunately, Markdown saw the underscore characters either side of geograph.org.uk, replaced them with <i> and </i>, and then URL encoded the result to produce this unusable URL:

http://commons.wikimedia.org/wiki/File:Buket_and_spade_on_Killahoey_Strand_-%3Ci%3Egeograph.org.uk%3C/i%3E-_1426946.jpg

-
Ouch, that's nasty. –  Ilmari Karonen Feb 5 '14 at 11:56
–  Ilmari Karonen Feb 5 '14 at 12:01
@IlmariKaronen Thanks for flagging it up :-) –  squeamish ossifrage Feb 5 '14 at 12:08