0

So I need to validate email addresses to ensure they have a valid TLD. I found http://data.iana.org/TLD/tlds-alpha-by-domain.txt has a list of current TLD's.

I came across records in that list like: "XN--VERMGENSBERATER-CTB" which with some googleing I found is a delegation record for a domain. Here is the iana info: https://www.iana.org/domains/root/db/xn--vermgensberater-ctb.html

My problem is that given the delegation record XN--VERMGENSBERATER-CTB how can I get the actual extension of .VERMÖGENSBERATER programatically?

fwiw I'm using c# but its the method of figuring out how to accomplish the task that I care about.

Thanks,

Greg Randall
  • 811
  • 7
  • 14
  • Checking the TLD is a peril waiting for you: how will you maintain the list of TLD you check? There are so many broken websites with outdated lists that still do not know that there are TLDs with more than 4 characters, and I am not even starting to speak about IDNs or EAIs. Please have a look at https://uasg.tech/wp-content/uploads/2016/05/UASG007-version-9-2017-02-02.pdf https://uasg.tech/wp-content/uploads/2017/09/UASG-Report-UASG017.pdf and https://uasg.tech/wp-content/uploads/2017/02/UASG014_20170206.pdf – Patrick Mevzek Jan 02 '18 at 20:34

1 Answers1

1

No, XN--VERMGENSBERATER-CTB is the IDN-encoded form of VERMÖGENSBERATER. For reasons that we need not go into here, all names in DNS have to be (a subset of) ASCII only. So in order to make it possible to have names with non-ASCII characters in them, like the 'Ö' here, they get encoded into ASCII. You can easily recognize names that have been encoded by the prefix 'XN--'.

You'll have to check the documentation of the programming environment you use to see if it does IDN-encoding of non-ASCII names for you, or if you have to handle that yourself.

Also, please reconsider if you really, really have to do that TLD check at all. It's near-certain that it won't actually accomplish what you want it to.

Calle Dybedahl
  • 5,228
  • 2
  • 18
  • 22