Sending link with hashtag via email causes lowercase hashtag?

Not sure exactly what’s happening, but if I send the following link using Apple Mail (haven’t tested with other email apps yet):

The “ABCDEFG” will appear correctly in the message body, but if you hover over the link it will show that for the link itself, everything after the # has been converted to lowercase “abcdefg.”

Is this an Apple Mail bug or a general rule for use with URLs? I’m trying to send links using case-specific hashtags.


I don’t believe that html hashtags are case sensitive.

It seems poorly defined from what I can tell. I haven’t been able to find a definitive answer. The fragment is not sent to the server, so it isn’t technically part of the URI. In HTML, the fragment points to the id of an element, which are not case sensitive. But despite all that, I couldn’t find a definitive answer.

Given what Mail is doing, I’d treat them as insensitive to be safe.

Right so as a followup, not a good idea to Base64 encode anything that might go into a hashtag.

Thanks guys.

Secondary followup, any good way besides Base64 to encode a small amount of data into the hashtag of a URL?

Just curious what are you putting in the hashtag that needs to be decoded?

Basically the equivalent of passing a few non-secure variables via the URL, which I wanted to handle with the Session.HashTagChanged event. A way of making a static link that the web app can parse and handle based on the content.

It’s working in testing here and the only issue I’ve seen is the aforementioned Apple Mail link problem. I didn’t want to use HandleSpecialURL because this should modify the current session.

I used to do the same thing but it gets so ugly so fast. I ended up implementing a type of URI system inside of a hashtag:


I am playing around with using HandleURL in combination with cookies to remove the hashtag dependency. It’s ugly to see in the browser and its very prone to user manipulation.

You could modify the Base64 encoding using a tag to mean uppercase, something like > URL encoded, which is %3E. So anything that should uppercase would show as for instance %3Ea%3Eb%3Ec%3Edthisislowercase. Then you can recover your Base64 uppercase characters by checking the tags inside HashTag.

Just tested fine :

[code] // Prepare Base64 for case insensitive url
dim encoded as string = encodebase64(TextField1.Text)
TextField4.Text = encoded
dim URLprepared as string
for i as integer = 1 to len(encoded)
if (ASC(mid(encoded,i,1))>64 and ASC(mid(encoded,i,1))<91 ) then
URLprepared = URLprepared + “%3E”+mid(encoded,i,1)
URLprepared = URLprepared + mid(encoded,i,1)
end if
TextField2.TExt = URLprepared

// Recreate the case sensitive Base64 from hashtag
Dim hashtag as string = lowercase(URLprepared) //got from email
for i as integer = 97 to 122
hashtag = replaceall(hashtag, “%3E”+chr(i), uppercase(chr(i)))
Textfield3.Text = hashtag[/code]

I quickly made that and it can probably be refined. In particular, it does not support accented characters. But from what you describe, that may not be necessary.

It is also possible that the client decodes the URL component and passes you a hashtag that contains “>” instead of “%3E” (I did not test with an actual mail client). It is easy to adapt the code to deal with it in the ReplaceAll series.