子域中的 utf-8?

发布于 2024-10-22 06:13:26 字数 412 浏览 1 评论 0原文

是否可以在子域中使用 UTF-8?如果是这样,哪些字符是允许的以及不能混合编码是如何工作的?

我尝试过 RTFM,但 Google 不太想要 帮助

Is it possible to use UTF-8 in a subdomain? If so, which characters are allowed and how does the can't-mix-encodings thing work?

I've tried to RTFM, but Google wan't of much help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉薄对峙 2024-10-29 06:13:26

子域没有太多特别之处。给定的域名 foo.example.com 是一个有序的标签列表(fooexamplecom) 。因此您可能想知道是否可以在给定标签中使用 UTF-8。

低级答案是标签定义为:

<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"

这意味着您只能在标签中找到 [-a-zA-Z0-9]

但是,IDNA 可用于对 Unicode 字符进行编码。简而言之,包含其他字符的标签编码为:"xn--" + punycode(nameprep(label))

至少就限制而言:

  • 字符不能出现在 IDN 标签中(U+002E、U+3002、U+FF0E、U+FF61)。

There aren't many things special about subdomains. A given domain name foo.example.com is an ordered list of labels (foo, example, com). So you might want to know if you can use UTF-8 in a given label.

The low level answer is that a label is defined as:

<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"

which means that you can only find [-a-zA-Z0-9] in a label.

However, IDNA can be used to encode Unicode characters. In short, a label containing other characters is encoded with: "xn--" + punycode(nameprep(label)).

As for limitations at least:

  • for characters can't be in a IDN label (U+002E, U+3002, U+FF0E, U+FF61).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文