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

后端 未结 3 2183
执念已碎
执念已碎 2021-02-15 04:19

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

相关标签:
3条回答
  • 2021-02-15 04:37

    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.

    0 讨论(0)
  • 2021-02-15 04:48

    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.

    0 讨论(0)
  • 2021-02-15 04:54

    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.

    0 讨论(0)
提交回复
热议问题