What is the maximum length of an IDNA converted domain name?

假如想象 提交于 2019-12-03 12:18:55

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.

OK, I think I found out myself and this snippet I found (by searching the internet) helped:

There were essentially two different options open for introducing internationalized domain names (IDN). The first was to make adjustments to the domain name system (DNS) which would allow unicode characters to be used directly. It was felt that this was too drastic a measure, and hence the second option was chosen. This involved compiling an algorithm to specify how a unicode string should be converted into a permitted ASCII domain name. This ACE string (ACE stands for ASCII Compatible Encoding) is then entered into the DNS. The introduction of IDN means that, for the very first time, the entry in the DNS is no longer identical with the domain name.

Source

The answer is that the length to respect is the 255 character limit as DNS expects it.

My suspicion was correct. The domain name and the entry in the DNS are two different things with IDN. It's the maximum length of the DNS entry that counts.

The domain name "müller.de" has 9 characters, but the corresponding ACE (ASCII Compatible Encoding) string "xn--mller-kva.de", however, has 16 characters.

It's the ACE string that is used by DNS and it's the ACE string that falls under the 255 character limit. This means that the maximum limit of it's unicode (domain) version is defined by the number of unicode characters used and if - after IDNA conversion - the string still fits within the 255 character limit.

Geez, the specs sure could've been be a bit clearer on things like this. Especially as international domain names have been around since somewhere near March 1st, 2004. But I found the answer, and that's what counts.

Perhaps this can help someone who's having the same question.

The simple answer related to my database field length is 255 CHARs.

The fact that I store the domain names in their IDNA converted (punycode/ACE string) version only confirms this maximum character limit.

RFC3492 says this about one of the features os IDNA encoding:

Efficient encoding: The ratio of basic string length to extended string length is small. This is important in the context of domain names because RFC1034 restricts the length of a domain label to 63 characters.

That is it. 63 characters is a maximum length for any domain name regadless of wether it is in IDNA or in ASCII.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!