HI guys,
I have a URL and I want to embed it in the body of a mailto
. Till now, I've tried 2 methods to encode the URL and both of them did not give me good results:
URLEncoder
- this gave me plus signs in the e-mail message since apparently URLEncoder is appropriate for query parameters only.
org.apache.commons.httpclient.URI
- this doesn't give me the complete URL. It gives me the same results as I had explained in a post earlier here: Escape & symbol in MailTo
What can I do?
Thanks :) Krt_Malta
Since spaces are converted to
+
, would it be sufficient to just replace all instances of+
with%20
in the body?Demo
How about using
URIUtil
fromhttpclient
?Encoding the following address
mailto:jo han.sjoberg@m.com
givesmailto:jo%20han.sj%C3%83%C2%B6berg@m.com
Technically though, both
+
and%20
are acceptable encoding for a whitespace.