Possible Duplicates:
Links to URLs containing parentheses
Please improve the auto-linking to allow square and round brackets

I tried posting the following link in a post on Stack Overflow.
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#convertColumnIndexToView(int)

However when clicking on the link, the browser cut off the last part of the url "(int)", so the link did not go to the correct anchor in the page. This happened in Google Chrome, I have not tried any other browsers yet. Is this a bug with Stack Overflow? Is there a way around it?

share|improve this question
    
@Jon that post isn't [status-completed]; this one is –  Pops Jan 20 '11 at 15:34
add comment

marked as duplicate by Arjan, ChrisF, Grace Note, Pops, Jon Seigel Jan 20 '11 at 18:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Use proper percent-encoding for reserved characters:

http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#convertColumnIndexToView%28int%29

(However, though reserved, a non-encoded bracket could be part of an URL. In this example, it should be encoded though, and meanwhile also fixes the problem with the clickable link...)

It's actually easier to just use Markdown's < ..>, just like shown in the "How to Format" box to the right when composing a post:

Hence:

<http://java.sun.com/[..]/JTable.html#convertColumnIndexToView(int)>

would yield:

http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#convertColumnIndexToView(int)

But: that's still ugly, and to make proper Markdown formatting work in the preview as well, you need the percent-encoded URL anyway:

[convertColumnIndexToView(int)](http://[..]#convertColumnIndexToView%28int%29)

yielding:

convertColumnIndexToView(int)

Much better!

Even though the preview doesn't like trailing parentheses when using the [name](url) or [name][id] syntax, the end result for both is actually fine.

share|improve this answer
add comment

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