雅虎邮件撰写链接中的 URI 编码 [英] URI encoding in Yahoo mail compose link

查看:24
本文介绍了雅虎邮件撰写链接中的 URI 编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有链接生成网络应用程序.我想让用户可以轻松地将他们创建的链接通过电子邮件发送给使用 gmail、雅虎邮件等的其他人.雅虎邮件有一个特殊的怪癖,我需要一个解决方法.

I have link generating web app. I'd like to make it easy for users to email the links they create to others using gmail, yahoo mail, etc. Yahoo mail has a particular quirk that I need a workaround for.

如果您有 Yahoo 邮件帐户,请点击此链接:

If you have a Yahoo mail account, please follow this link:

http://compose.mail.yahoo.com/?body=http%3A%2F%2Flocalhost%3A8000%2Fpath%23anchor

注意 yahoo 重定向到特定的邮件服务器(例如 http://us.mc431.mail.yahoo.com/mc/compose).这样做时,它会解码十六进制代码.其中之一,%23,是一个哈希符号,在查询字符串参数值中是不合法的.%23 之后的所有信息都丢失了.

Notice that yahoo redirects to a specific mail server (e.g. http://us.mc431.mail.yahoo.com/mc/compose). As it does, it decodes the hex codes. One of them, %23, is a hash symbol which is not legal in a query string parameter value. All info after %23 is lost.

我所有的链接都坏了,不能只使用另一个字符.

All my links are broken, and just using another character is not an option.

直接致电 us.mc431.yahoo.com 对我有用,但可能不适用于所有用户,具体取决于他们的位置.

Calling us.mc431.yahoo.com directly works for me, but probably not for all users, depending on their location.

我尝试设置 html=true|false,将 URL 放在 html 标记中.什么都行不通.对于这个特殊的怪癖,有人有可靠的解决方法吗?

I've tried setting html=true|false, putting the URL in a html tag. Nothing works. Anyone got a reliable workaround for this particular quirk?

注意:任何基于服务器的解决方法对我来说都不是初学者.这必须是雅虎和最终用户之间的链接.

Note: any server-based workaround is a non-starter for me. This has to be a link that's just between Yahoo and the end-user.

谢谢

推荐答案

我是这样做的:

  1. 在这些字符上运行 window.escape:&' " # > < \

在完整字符串上运行 encodeURIComponent

它适用于我的大部分情况.尽管换行符 (\n) 仍然是一个问题,但在我的情况下,我用空格替换了 \n 并且效果很好.

it works for most of my case. though newline (\n) is still an issue, but I replace \n with space in my case and it worked fine.

这篇关于雅虎邮件撰写链接中的 URI 编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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