IDNA转换域名的最大长度是多少? [英] What is the maximum length of an IDNA converted domain name?

查看:235
本文介绍了IDNA转换域名的最大长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一件事:



我将多个域存储到数据库后,将每个域名转换为它是IDNA版本。我需要知道这样一个IDNA转换的域名的最大长度可以这样定义数据库字段的最大长度。



已知事实: strong>



现在,我知道域名(包括任何子域)中的最大字符数是255个字符。



我失去了它:



这很容易乍一看,但是。这是否意味着国际字符的常规ASCII字符(认为是UTF-8编码)?给你一个例子:域名müller.de有9个字符,当我忽略ü是一个国际字符,需要更多的字节来表示。 IDNA版本的müller.de是xn--mller-kva.de,其中有16个字符。这显示最大长度绝对有差异,具体取决于if是否是IDNA转换。



根据他们的意思是什么样的字符,255个字符的最大值可以是国际字符版本,IDNA转换版本甚至两者。



这就是我失去了一点...特别是,因为我不得不考虑到,并不是所有的域名都将是理智的,像öüßüöäéèê .example.äöüßüöäéèê-äöüßüöäéèê.test.äöüßüöäéèê.com,更糟糕的是预期。



所以,猜和希望最好不是一个选择。我需要知道...



问题是:



基于已知事实,域名(包括任何子域)中的最大字符数为255个字符... IDNA转换的域名的最大长度是多少?



还是意味着IDNA转换版本(punycode)也限制在255个字符(这意味着具有国际/ unicode字符的域实际上具有较短的限制在他们的unicode表示中,因为他们的IDNA转换版本将不得不遵守255个char限制)?

解决方案

我的理解是



这是因为DNS记录具有此字符限制,并且在一般的DNS记录中只能包含字母,数字和连字符(维基百科)。因此,DNS服务器使用IDN的Punycode版本作为其记录,而不是Unicode版本。


First things first:

I'm storing multiple domains to a database, after I've converted each and every domain name to it's IDNA version. What I need to know the maximum length such an IDNA-converted domain name can have so I can define the database field's max length.

Known fact:

Now, I know the maximum number of characters in a domain name (including any subdomains) is 255 characters.

Where I lost it:

That's easy at first glance, but... does this mean regular ascii characters of international characters (think UTF-8 encoding)?

To give you an example: The domain "müller.de" has 9 characters when I ignore that "ü" is an international character that needs more bytes to be represented. The IDNA version of "müller.de" is "xn--mller-kva.de", which has 16 characters. This shows there's definitely a difference in maximum length depending on "if" it is IDNA converted or not.

Depending on what kind of characters they mean, the 255-character maximum could be the international character version, the IDNA converted version or even both.

And that's where I lost it a bit... especially, since I have to take into account that not all domains will be sane and stuff like "öüßüöäéèê.example.äöüßüöäéèê-äöüßüöäéèê.test.äöüßüöäéèê.com" and even worse is to be expected.

So, "guessing" and "hoping for the best" is not an option. I need to know for sure...

The question is:

Based on the known fact that the maximum number of characters in a domain name (including any subdomains) is 255 characters... what is the maximum length of an IDNA converted domain name?

Or did they mean the IDNA converted version (punycode) is also restricted to 255 characters (which would mean that domains with international/unicode characters would actually have shorter limits in their unicode representation, because their IDNA converted version would have to respect the 255 char limit)?

解决方案

My understanding is that the 255-character limit is to be considered after the IDNA conversion.

This is because DNS records have this character limit, and in general DNS records can only contain letters, digits and hyphens (from Wikipedia). The DNS server therefore uses the Punycode version of the IDN for its record, not the Unicode version.

这篇关于IDNA转换域名的最大长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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