UTF8中的特殊字符mailto:subject = link和Outlook [英] Special characters in UTF8 mailto: subject= link and Outlook

查看:424
本文介绍了UTF8中的特殊字符mailto:subject = link和Outlook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在重新编码正式使用iso-8859-1字符编码的网站的最后阶段,但现在是整个UTF-8。



问题是当使用特殊字符时,mailto href链接的主题部分不能与Outlook一起使用。我得到通常的乱码字符表示,指示当链接被点击并且新的邮件窗口弹出Outlook Outlook时出现明显的字符编码问题。



我已经尝试过rawurlencode ()来解决这个问题,但这似乎不适用于Outlook ...

 < a href = mailto:blah@blah.com?subject =<?= rawurlencode($ subj);?>>发送电子邮件< / a>那么以为Outlook必须坚持使用不同的编码,并尝试用utf-8解码主题字符串首先... 

 < a href =mailto:blah@blah.com?subject =<?= rawurlencode utf8_decode($ subj));?>>发送电子邮件< / a> 

宾果!工作伟大的展望。但是现在一切都失败了:(



我找不到所有邮件客户端的解决方案。



当整个页面显示在iso-8859-1中时,所有邮件客户端都可以正常工作,但是当页面内容是utf-8时不会。



不幸的是客户希望保留这个直接的电子邮件链接,尽管在其下方有一个正常的邮件表单!



有没有一个愉快的解决方案?

解决方案

如果您使用utf-8,请尝试:

  <?php $ subject ==?UTF-8?B?base64_encode($ subject)?=;?> 


I'm in the last stages of re-coding a site that formally used iso-8859-1 character encoding, but now is UTF-8 throughout.

The problem is that the subject section of the mailto href link is not working with Outlook, when special characters are used. I get the usual garbled character representations, indicative of an obvious character encoding issue when the link is clicked and the new mail window pops up in outlook.

I've tried rawurlencode() to fix ths issue, but this doesn't seem to work with Outlook...

<a href="mailto:blah@blah.com?subject=<?=rawurlencode($subj);?>">send email</a>

So then thought, Outlook must insist on a different encoding, and tried utf-8 decoding the subject string first...

<a href="mailto:blah@blah.com?subject=<?=rawurlencode(utf8_decode($subj));?>">send email</a>

Bingo! Works great Outlook. But now fails in everything else :(

I can't find a solution that works accross all mail clients.

It worked fine across all mail clients when the whole page was displayed in iso-8859-1. But not when the page content is utf-8.

Unfortunately the client wants to retain this direct email link, despite having a functioning mail form directly beneath it!

Is there a happy solution to this?

解决方案

If you use utf-8 try this:

<?php $subject = "=?UTF-8?B?" . base64_encode($subject) . "?="; ?>

这篇关于UTF8中的特殊字符mailto:subject = link和Outlook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆