简体   繁体   中英

Convert String to HTML Ready text for MAILTO: URL

I am writing a large Java Application in which I would like to include a "Send Email" button. All it does is open a mailto url with the appropriate headers.

The only difficulty I am having is parsing the input strings so that they are formatted appropriately, for example: mailto:someone@somewhere.net?subject=This is the subject needs to become mailto:someone@somewhere.net?subject=This%20is%20the%20subject

You can try URLEncoder , specifically the encode method that can be found here .

You most likely need to "URLEncode" (translates the space characters (' ') to %20.

See this document: http://download.oracle.com/javase/1.5.0/docs/api/java/net/URLEncoder.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM