mailto不可读的字符-unicode [英] mailto unreadable characters - unicode
问题描述
我正在使用网站中的mailto URI方案通过电子邮件发送当前页面.
I am using the mailto URI scheme in my website for emailing the current page.
问题是我使用北印度语作为mailto链接中的主题
The problem is i use Hindi as the subject in the mailto link
示例
<a href="mailto:test@gmail.com?subject=मानक हिन्दी">Testing</a>
单击链接时,将打开Outlook(版本6),它显示一些不可读的字符作为主题,而不是"मानकहिन्दी",即我得到"'मà¤"
When the link is clicked, the Outlook(version 6) opens and it displays some unreadable characters as subject instead of "मानक हिन्दी" i.e i get "'मानक हिनà¥à¤¦à¥€"
我正在使用PHP,所以我尝试使用urlencode,utf8_encode和其他类似功能,但没有用.该页面的默认字符集为UTF-8
I am using PHP so i tried using urlencode, utf8_encode and other similar functions and it is of no use. And the page's default character set is UTF-8
当我直接粘贴文本मानकहिन्दी时,它会起作用.
When i directly paste the text मानक हिन्दी, it works.
但是我需要它作为mailto链接...解决方案是什么?
But i need it as a mailto link... What will be the solution ?
推荐答案
不幸的是,这只能在Outlook端通过设置选项允许对mailto:协议的UTF-8支持"来解决.(在2010年,该选项位于选项"->高级"->国际选项"下.)
Unfortunately this can only be fixed at the Outlook end, by setting the option ‘Allow UTF-8 support for the mailto: protocol’. (In 2010 this is under Options -> Advanced -> International options.)
否则,默认情况下,Outlook将使用用户特定于语言环境的桌面默认编码("ANSI"代码页),该编码永远不会为UTF-8.这使得在mailto:URL中使用非ASCII字符非常不可靠,因而实际上是无用的.(甚至比 subject =
的正常不可靠性还重要.)
Otherwise, and by default, Outlook will use the user's locale-specific desktop default encoding (the ‘ANSI’ code page) which is never UTF-8. This makes using non-ASCII characters in a mailto: URL so unreliable as to be effectively useless. (Even more than the normal unreliability of subject=
.)
通常,对非ASCII字符串进行URL编码的想法是正确的:使用类似URI的
In general the idea to URL-encode the non-ASCII string was the right one: using a URI like:
<a href="mailto:test@gmail.com?subject=%E0%A4%AE%E0%A4%BE%E0%A4%A8%E0%A4%95%20%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80">Testing</a>
比使用原始Unicode的IRI格式更可靠.但是,这不能解决Outlook问题.
Is more reliable than the IRI format with the raw Unicode. However this does not address the Outlook issue.
这篇关于mailto不可读的字符-unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!