Search code examples
javascripthtmlgoogle-chromeencodingmailto

Special Character when using the mailto: option


I am using a simple mailto option in my html so that whenever the user clicks on the mailto, it creates a pre defined email with subject and body. The issue is that, the functionality works fine but there is a special character  before the currency symbol and i am clueless what might be the reason.
Also, Weirdly this happens only when i use chrome and not firefox. (Never tested in IE) Any directions on how to proceed with this? The code is pretty simple and straight forward

<a id="body_0_contentcolumn_0_hypOutlook" href="mailto:?subject=test subject&amp;body=Hi, how are you?%0A%0AI wanted to share a job I thought you might be interested in.Salary £15000.00- £25000.00%0A%0AYou can view more details and apply online here:www.apply.com">Outlook </a>

Pls find the fiddle below..

Click here for Fiddle

i am using outlook 2013 and Chrome 33


Solution

  • It's all about encoding.

    £ is character number 0xA3. This, when encoded "properly" (ie. in UTF-8), is converted to 0xC2A3 - coincidentally, you have the same A3 in there, which means the rendered result, £, looks like it just acquired a "random"  out of nowhere.

    Solution: Encode the £ properly. Try &pound; first, and if that doesn't work try %A3.