电子邮件mailto主题行中的中文字符
我想在 mailto: 电子邮件链接中添加一些中文字符。
我已经尝试过,
<a href="mailto:[email protected]?subject=调查 / Inquiry">Email</a>
但是当我单击链接时,Outlook 主题行显示:
调查亡ª·æ£® / 查询
我也尝试过
<a href="mailto:[email protected]?subject=调查 / Inquiry">Email</a>
,但得到了与上面相同的结果。
我意识到这可能是 Outlook 问题,但我有兴趣找出实现此功能的正确方法。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
原始 URL 编码
要使用特殊字符对 mailto 链接/标准链接进行编码,您可以使用 php 函数 rawurlencode
如果您正在寻找在线工具,请尝试 http://www. Cafewebmaster.com/online_tools/rawurlencode
使用您的示例:
[电子邮件受保护]?subject=调查/查询">电子邮件
将转换为:
[电子邮件受保护]?subject=%E8%B0%83%E6%9F%A5 / 询价">邮箱
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>
由于主题位于邮件标头中,因此无法知道您正在使用什么编码。 您需要使用此 RFC 中定义的 MIME 邮件标头扩展,
http://www.ietf.org /rfc/rfc2047.txt
中文的主题是这样的,
但是现在越来越多的客户端采用UTF-8编码。 您可能也想尝试一下。
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,
But more and more clients assume UTF-8 encoding now. You might want try that also.
因为outlook默认的字符集是gb2312,所以在对主题进行编码时,必须将汉字翻译成gb2313,然后再进行编码。
总之,你传递的字符集必须与outlook默认的字符集一致。
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.
一段时间以来,我一直在尝试在主题行中放入非 ASCII 字符。 底线是:它不能可靠地工作。
我对它不起作用的(有限)理解是,标准规定电子邮件是 7 位 ASCII。 MIME 标准通过对电子邮件内容进行不同的编码来解决这个问题。 但是:主题行不是内容的一部分。 这是一个标题。
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.
对于评论 #1 中的文本,请启用“工具->选项->邮件格式->国际选项”->“启用 mailto: 协议的 UTF-8 支持”
For your text in comment #1, please enable the "Tool->options->mail format->International Options"->"Enable UTF-8 support for mailto: protocol"
这很麻烦,但可能,这里 是一篇很好的文章,讨论了 Internet Explorer 的理想世界和现实世界场景的标准兼容方式。
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.