子域中的 utf-8?
是否可以在子域中使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
子域没有太多特别之处。给定的域名
foo.example.com
是一个有序的标签列表(foo
、example
、com
) 。因此您可能想知道是否可以在给定标签中使用 UTF-8。低级答案是标签定义为:
这意味着您只能在标签中找到
[-a-zA-Z0-9]
。但是,IDNA 可用于对 Unicode 字符进行编码。简而言之,包含其他字符的标签编码为:
"xn--" + punycode(nameprep(label))
。至少就限制而言:
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:
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: