HTML mailto subject and body display plus sign(+) instead of space in mail client

5.5k views Asked by At
It's happening in
- Samsung Galaxy Note3 & 4
- Google Chrome browser V39.XX

I am using a link and when click it's launch the mail client

href="mailto:[email protected]?subject=Network%20issue"

result: subject=Network+issue

How to remove the plus(+) sign?

2

There are 2 answers

1
TMan On

Your original approach should work... The only reason that comes to mind behind it not working is perhaps encodings are being mixed up along the way? Take a look at these threads to get a better idea of what I mean:

mailto special characters

Special characters in UTF8 mailto: subject= link and Outlook

I experimented with the base64 approach that is the answer in the second link but was unable to remedy the issue :-\ I tested this on Gmail, Inbox, and Mailbox - all with the same results as what you are describing above.

Maybe something is getting messed up at the Android layer in terms of how the link is being handed off to the mail client of your choice?

0
Antfish On

If you're rendering using Javascript, try encoding as a URL using encodeURIComponent

const urlEncoded = encodeURI(mailToLink);

before you pass the URL to the mailTo link. Otherwise encode it in the backend first.

This can be done with email addresses that contain special characters too.