Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Fundamentally, I want to create this link in a comment and have it go to the right place: String(byte[],Charset)



Two issues emerge:

  1. The actual link strips the square brackets (presumably because they're improperly encoded), this is livable but undesirable, I can url-encode them myself
  2. Comments incorrectly fail to escape the brackets, leading to a messy rendering of:


Without the code format I recognize it's possible to escape the slashes, rendering correctly as String(byte[],Charset)

However, with inline code formatting and escaped slashes, I simply see the slashes:


share|improve this question
e.g. String(byte[],Charset) – Mark Elliot Jul 7 '11 at 3:25
Note that it isn't switched to a link but rather a [name] next to an link. – M. Tibbits Jul 7 '11 at 3:30
I wish there was some way to count the number of people who have just tried to replicate (in these comments) your bug... – M. Tibbits Jul 7 '11 at 3:31
@M.: Lance tried at least 4 times, I saw 3 other alerts since then. – Mark Elliot Jul 7 '11 at 3:32
Note: they should be encoded according to this question. – M. Tibbits Jul 7 '11 at 3:35
@M.: Unfortunately Google is failing to encode them =/ – Mark Elliot Jul 7 '11 at 3:37
So in other words, this: String(byte\[\],Charset) still fails. – M. Tibbits Jul 7 '11 at 3:52
@M.: precisely. – Mark Elliot Jul 7 '11 at 3:53
up vote 3 down vote accepted

You cannot escape anything in code spans (because you shouldn't have to), with one exception: If the code span is delimited by single backticks, you can escape backticks (for historical reasons). If it's enclosed by multiple backticks, e.g. ``here is a backtick: ` <-- see?``, you can't (and don't have to) escape anything anymore. See this answer for more.

The fact that the closing bracket broke stuff was merely a bug; that's fixed in the next build. Your original version will then work, except for – as you noted – the requirement to url-encode brackets in the link.

share|improve this answer
You are fast!!! – M. Tibbits Jul 7 '11 at 7:16
@balpha: The escaping of backticks ` in inline code in comments is not purely for historical reasons. How else could I produce `? – Hendrik Vogt Jul 7 '11 at 9:06
@HendrikVogt: By enclosing the code in multiple backticks (like my example above). Until the change from the answer I linked to (on your question), multiple backtick blocks were not supported in comments, so back then the only way to have a backtick in code was escaping, and for historical reasons (call it backwards-compatibility if you will) we left that in. Try it in a post -- real Markdown doesn't have that escaping thing. – balpha Jul 7 '11 at 9:27
@balpha: Try it yourself: `` ` `` gives `` ` ``. – Hendrik Vogt Jul 7 '11 at 9:29
@balpha: And ````` gives `````. The problem is that spaces are no longer allowed at the start and end of inline code in comments. (I wonder why!) – Hendrik Vogt Jul 7 '11 at 9:30
@HendrikVogt: Well yeah, but that's nothing new -- I'm also mentioning that in my answer. That's certainly not the reason for leaving backslash-escaping in. – balpha Jul 7 '11 at 9:38
@balpha: No, indeed not new. So I'm even more puzzled why you write "By enclosing the code in multiple backticks" as an answer to my question "How else could I produce `?". (Ah, maybe this wasn't clear to you: I meant producing this very inline code `, consisting of a single backtick. See, yesterday I was asked how one does this on!) – Hendrik Vogt Jul 7 '11 at 9:43

You can, but there's a couple things with your link. The square brackets can be escaped with a \, but the link should also really be encoded properly. I will add a comment on this answer using the following, (note the \[\]):

[String(byte\[\],Charset)](, java.nio.charset.Charset))

After OP's edit:

Comments are parsed with mini-markdown, which intentionally supports a subset of the markdown syntax. This is very much intentional, as comments are just for quick things and should not need the full formatting that markdown in posts use.

share|improve this answer
String(byte[],Charset) – Rebecca Chernoff Jul 7 '11 at 3:39
Your link fails to go to the right place, the square brackets are dropped from the actual href. – Mark Elliot Jul 7 '11 at 3:41
Further, escaping fails when using inline code ticks: String(byte\[\],Charset) – Mark Elliot Jul 7 '11 at 3:41
@Rebecca, your link strips out the []. I think you need to encode the [] to %5b%5d (But only in the actual link) – M. Tibbits Jul 7 '11 at 3:42
@MarkElliot Meh, copy/paste error, but just encode the url correctly. I think you need to escape the code ticks too maybe? Comments use mini-markdown which is only a subset of the markdown syntax that posts use. They aren't meant for complicated formatting like this. – Rebecca Chernoff Jul 7 '11 at 3:43
Eh, I shouldn't need to escape my code ticks, I want to link code format, e.g.: String(byte<>,Charset) – Mark Elliot Jul 7 '11 at 3:44
Sorry, I've partially invalidated your answer by refining my question to be more accurate and more concise. – Mark Elliot Jul 7 '11 at 3:49
@MarkElliot,'ve edited to be an exact dupe of – Rebecca Chernoff Jul 7 '11 at 3:52
@Rebecca: nope, I've edited to indicate that I cannot both escape slashes and use inline code formatting for links. My actual link contains the url-encoded square brackets, the issue is in the label. – Mark Elliot Jul 7 '11 at 3:53
@MarkElliot, you edited after my comment again. I've now edited my answer to match...I think. – Rebecca Chernoff Jul 7 '11 at 3:57

So to get this to work, as @RebeccaChernoff noted, you must escape the [] in the link text and encode them in the link itself. Check out this page on URL Encoding.

Update: So what you want is achieved by this:

[`String(byte`\[\]`,Charset)`](,%20java.nio.charset.Charset))  note the double '`'

Update 2:


Will get you the opening bracket but not the closing one. See below in comments. (After experimenting for 30 minutes, this is the closest I can get. See my last comment)

share|improve this answer
String(byte[],Charset) – M. Tibbits Jul 7 '11 at 3:44
Yeah, that was a copy/paste fail on my part. I edited. – Rebecca Chernoff Jul 7 '11 at 3:45
My word. Eight tries for me to get that link right!!. eek. – M. Tibbits Jul 7 '11 at 3:46
Unfortunately this doesn't resolve the problem as I'd like to use inline code formatting, too. (edited question to be more precise) – Mark Elliot Jul 7 '11 at 3:50
String(byte[],Charset) – M. Tibbits Jul 7 '11 at 3:54
That's close, but I want code formatted square brackets. Seeing as the behavior is unexpected I'd still call this a bug -- though maybe this is a (poor?) workaround. – Mark Elliot Jul 7 '11 at 3:56
So you want [String(byte[],Charset)] to link as above. I can't get it to work. – M. Tibbits Jul 7 '11 at 3:58
String(byte[],Charset) – M. Tibbits Jul 7 '11 at 4:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .