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

后端 未结 3 2175
执念已碎
执念已碎 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: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.

提交回复
热议问题