Pasting URLs into email messages has always made me somewhat uneasy, when the URL is right at the end of a sentence or right before a closing parenthesis: how do I know that the receiver’s email application knows to tell the puctuation apart from the URL? For example, let me enclose a URL (http://mummila.net/nuudelisoppa) here. Will the receiver’s browser take them to http://mummila.net/nuudelisoppa) instead of http://mummila.net/nuudelisoppa without the closing bracket?
Sometimes I work around this by using extra whitespace between the last character of the URL and the closing bracket or other punctuation immediately following it like so: http://mummila.net/nuudelisoppa .
But that looks just stupid. Also, the punctuation turns into an orphan all too easily.
Well, I just realized that for some URLs there’s a trick I can use to work around the issue: instead of whitespace, use #. The hash in URLs is used as a fragment identifier, and if there’s no corresponding identifier in the document you’re referring to, the fallback is to just go to the document top — which is where you wanted to point to, anyway: http://mummila.net/nuudelisoppa/#.
There are cases where this still doesn’t work, or works unlike intended.
If your URL already has a fragment identifier (https://secure.wikimedia.org/wikipedia/en/wiki/Bracket#Parentheses_.28_.29), it’ll fail to point to your intended target when you add another #identifier to it (https://secure.wikimedia.org/wikipedia/en/wiki/Bracket#Parentheses_.28_.29#).
Also, at least in theory it’s possible that there’s an identifier made up of a single punctuation character — say, an
id="." — in the document you’re referring to, and you don’t intend to point to that identifier but to document top. Using # just before said punctuation then makes your link point to the fragment rather than document top.