Take the 2-minute tour ×

I have link generating web app. I'd like to make it easy for users to email the links they create to others using gmail, yahoo mail, etc. Yahoo mail has a particular quirk that I need a workaround for.

If you have a Yahoo mail account, please follow this link:


Notice that yahoo redirects to a specific mail server (e.g. http://us.mc431.mail.yahoo.com/mc/compose). As it does, it decodes the hex codes. One of them, %23, is a hash symbol which is not legal in a query string parameter value. All info after %23 is lost.

All my links are broken, and just using another character is not an option.

Calling us.mc431.yahoo.com directly works for me, but probably not for all users, depending on their location.

I've tried setting html=true|false, putting the URL in a html tag. Nothing works. Anyone got a reliable workaround for this particular quirk?

Note: any server-based workaround is a non-starter for me. This has to be a link that's just between Yahoo and the end-user.


share|improve this question
add comment

4 Answers

Here is how i do it:

  1. run a window.escape on those chars: & ' " # > < \

  2. run a encodeURIComponent on the full string

it works for most of my case. though newline (\n) is still an issue, but I replace \n with space in my case and it worked fine.

share|improve this answer
add comment

For the newline, add the newline as < BR > and double encode it also, it is interpreted successfully as new line in the new message

share|improve this answer
This no longer seems to work. –  Aneil Mallavarapu Jan 22 at 21:00
add comment

I have been dealing with the same problem the last couple of hours and I found a workaround!

If you double-encode the anchor it will be interpreted correctly by Yahoo. That means change %23 to %2523 (the percent-sign is %25 encoded).

So your URI will be:

The same workaround can be used for ampersand. If you only encode that as %26, then Yahoo will convert that to "&amp;" which will discard the rest of message. Same procedure as above - change %26 to %2526.

I still haven't found a solution to the newline-problem though (%0D and %0A).

share|improve this answer
add comment

I think you're at the mercy of what Yahoo's server does when it issues the HTTP redirect. It seems like it should preserve the URL escaping on the redirect, but isn't. However, without knowledge of their underlying application, it's hard to say why it wouldn't. Perhaps, it's just an unintended side effect (or bug), or perhaps some of the Javascript features on that page require them to do some finagling with the hash tag.

share|improve this answer
add comment

Your Answer


