您需要遵循 IDNA 约定:
为了防止包含连字符的非国际域名被意外解释为 Punycode,国际域名 Punycode 序列有一个所谓的 ASCII 兼容编码 (ACE) 前缀,“xn--”,前置。 [2] 因此,域名“bücher.tld”将在 ASCII 中表示为“xn--bcher-kva.tld”。
使用 python,您可以尝试encode('idna')
查找要使用的字符,例如:
$ python
>>> x = u'bücher.tld'
>>> x.encode('idna')
b'xn--bcher-kva.tld'
>>> x.encode('idna').decode('idna')
'bücher.tld'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句