简体   繁体   中英

mailto link on iOS device keeps URL encoding

I have a mailto link on a webpage that contains a url-encoded subject. The link opens the default mail client like Gmail and decodes the string correctly but when I click the same link on my iPhone, it opens the Mail app but the content is still url-encoded.

eg

<a href="mailto:test@test.com?subject=hello+there">Email me</a>

in Gmail the subject is: "hello there" but in Mail app on the iPhone the subject is "hello+there" .

Is there any way around this? Perhaps via JS?

Thanks,

G

The encoding you are using is not URL including in its traditional form. Gmail may support it, but ios won't. The solution here is to use the 'real' URL encoding method, which uses %HEX_ASCII_CODE to encode characters. In this scenario, the hexadecimal ASCII code for space is 0x20, thus making the proper value for space '%20'.

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