在 URL 中使用逗号有时会破坏 URL? [英] Using commas in URL's can break the URL sometimes?

查看:32
本文介绍了在 URL 中使用逗号有时会破坏 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在 SEO 友好 URL 中使用逗号有任何问题吗?我正在使用一些在 SEO 友好 URL 中使用大量逗号的软件;但我 100% 肯定我已经看到某些程序/平台无法正确识别 URL 的情况&在第一个逗号之后切断 URL 的链接".

Is anyone aware of any problems with using commas in SEO friendly URL's? I'm working with some software that uses a lot of commas in it's SEO friendly URL's; but I am 100% certain I have seen some instances where some programs/platforms don't recognize the URL correctly & cut the "linking" of the URL off after the first comma.

我刚刚用雷鸟、gmail、hotmail & 测试了这个在没有问题的 SMF 论坛上;但是我知道我以前见过这个问题.

I just tested this out with thunderbird, gmail, hotmail & on a SMF forum with no problems; however I know I have seen the issue before.

所以我的问题是,有什么特别的事情会导致某些平台停止用逗号链接 URL 吗?比如逗号后面的某个字符?

So my question is, is there anything in particular that would cause some platforms to stop linking URL's with a comma? Such as a certain character after the comma?

推荐答案

将会有 无数 个实现来切断自动链接.与许多其他角色一样.但这不是因为使用了这些字符,而是因为错误/不完整的实现.

There will be countless implementations that will cut the automatical linking at that point. As with many other characters, too. But that’s not a problem because of using these characters, but because of a wrong/incomplete implementation.

例如参见这个网站 Stack Overflow.手动输入/粘贴此 URL 时,它会切断 * 处的链接(查看错误;如果它得到修复,这里是一个 它的屏幕截图):

See for example this very site, Stack Overflow. It will cut off the link at the * when manually entering/pasting this URL (see bug; in case it gets fixed, here’s a screenshot of it):

但是当使用超链接语法时,它工作正常:

But when using the hyperlink syntax, it works fine:

在 HTTP URL 路径中允许使用 * 字符,因此链接检测应该识别第一个 URL,而不是在出现 * 时破坏它.

The * character is allowed in an HTTP URL path, so the link detection should have recognized the first URL instead of breaking it at the occurence of *.

关于逗号:

逗号是一个保留字符,其含义是相关的对于 URL path(我的粗体强调):

The comma is a reserved character and its meaning is relevant for the URL path (bold emphasis mine):

除了分层路径中的点段外,路径段是被通用语法认为是不透明的.URI 生成应用程序通常使用段中允许的保留字符来分隔特定于方案或取消引用处理程序特定的子组件.为了例如,分号(;")和等号(=")保留字符是常用于界定适用于的参数和参数值那个段.逗号(,")保留字符通常用于类似的目的.例如,一个 URI 生产者可能使用一个段例如名称;v=1.1"表示对 1.1 版的引用name",而另一个可能使用诸如name,1.1"之类的段.到表示相同.

Aside from dot-segments in hierarchical paths, a path segment is considered opaque by the generic syntax. URI producing applications often use the reserved characters allowed in a segment to delimit scheme-specific or dereference-handler-specific subcomponents. For example, the semicolon (";") and equals ("=") reserved characters are often used to delimit parameters and parameter values applicable to that segment. The comma (",") reserved character is often used for similar purposes. For example, one URI producer might use a segment such as "name;v=1.1" to indicate a reference to version 1.1 of "name", whereas another might use a segment such as "name,1.1" to indicate the same.

因此,如果您不打算使用逗号作为保留字符的函数,您可能需要使用 %2C 对其进行百分比编码.用户从浏览器的地址栏中复制此类 URL 会将其粘贴到编码形式中,因此它几乎可以在任何地方使用.

So, if you don’t intend to use the comma for the function it has as reserved character, you may want to percent-encode it with %2C. Users copying such an URL from their browser’s address bar would paste it in the encoded form, so it should work almost everywhere.

但是,尤其是因为它是一个保留字符,未编码的形式也应该可以工作.

However, especially because it’s a reserved character, the unencoded form should work, too.

这篇关于在 URL 中使用逗号有时会破坏 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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