What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

I just tried to post a deeplink to a method inside of the Android documentation in a comment. I noticed that because of the format of the URL the link does not work correctly.

Here is the url in question:

http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String, int)

it seems that the space in the parameters of the method seems to break the URL.

Is there some way to make this link(and ones like it) function properly that I've missed or do is this simply a limitation of the system?

If it is the latter I'd like to formally suggest that we try to come up with a way to allow URLs such as these to work properly.

EDIT: test

http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String%2C%20int)

http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String,%20int)

URL encoding the space does not seem to help all the way.

Another test:

Context.openFileOutput(String s, int i)

Ok, this one worked. Is there some way I can make it work in comments though?

share|improve this question
    
Er, EDIT2, Solved, Edit, how the heck are people supposed to extract the feature request from the above...? –  Arjan Jul 23 '12 at 16:09
    
it was a poor attempt to indicate that the technical problem of making the links work was solved by the answer below. But that I'd like to see some way to make it less tedious implemented if at all possible. It turned out cunfusing, I've removed it. –  FoamyGuy Jul 23 '12 at 17:30

1 Answer 1

up vote 2 down vote accepted

Spaces are not normally valid characters in URLs, though many browsers support them by translating the spaces to escape sequences internally.

You can escape spaces by hand by replacing them with %20:

http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String,%20int%29

The closing parenthesis is also a problem, but for different reasons; it is seen by the StackExchange markdown parser as outside the URL, part of the surrounding text. I replaced that with the %29 escape (29 is the ASCII code for a closing parenthesis. Note that this applies to all punctuation; had your URL ended in a full stop, a comma or an exclamation mark, you would have to escape those as well for the link to work properly.

This goes for both full-markdown posts and for comments.

Incidentally, when I copy the working URL from Firefox into the editor here, the closing parenthesis is automatically escaped the same way.

share|improve this answer
    
there we are, its working now with the escaped paren too =) Thank you. –  FoamyGuy Jul 23 '12 at 15:38
1  
Comment demonstration: developer.android.com/reference/android/content/… –  Martijn Pieters Jul 23 '12 at 15:42

You must log in to answer this question.

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