I'm looking to add some Chinese characters in a mailto: email link.
I've tried
<a href="mailto:[email protected]?subject=调查 / Inquiry">Email</a>
but when I click on the link the Outlook subject line shows:
调查亨德森 / Inquiry
I've also tried
<a href="mailto:[email protected]?subject=调查 / Inquiry">Email</a>
but I get the same result as above.
I realize this may be an Outlook issue but I'm interested in finding out the correct way to implement this functionality.
Raw URL Encode
To encode mailto links / standard links with special characters you can use the php function rawurlencode
If you are looking for an online tool try http://www.cafewebmaster.com/online_tools/rawurlencode
Using your example:
<a href="mailto:[email protected]?subject=调查 / Inquiry">Email</a>
would convert to:
<a href="mailto:[email protected]?subject=%E8%B0%83%E6%9F%A5 / Inquiry">Email</a>
Since subject is in mail header, there is no way to know what encoding you are using. You need to use MIME Mail header extension defined in this RFC,
http://www.ietf.org/rfc/rfc2047.txt
The subject in Chinese would look like this,
Subject: =?GB2312?B?u7bTrbLOvNPDwLn61bm74Q==?=
But more and more clients assume UTF-8 encoding now. You might want try that also.
It's cumbersome but possible, here is a good article that discusses both the standard compliant way of an ideal world and real world scenarios with Internet Explorer.
For your text in comment #1, please enable the "Tool->options->mail format->International Options"->"Enable UTF-8 support for mailto: protocol"
I've been trying to put non-ASCII characters in subject lines for a while now. The bottom line is: it does not work reliably.
My (limited) understanding of why it does not work is that the standards say that email is 7-bit ASCII. The MIME standard gets around that by encoding the contents of the email differently. However: the subject line is not part of the contents. It's a header.
Because the default charset of outlook is gb2312, so when you encode the subject, you must translate the Chinese character to gb2313, then encode it. In a word, the charset which you pass must be consistent with the default charset of outlook.