I occasionally stumble over a DNS country-code Top-Level domain (ccTLD) I don’t immediately recognize for the simple reason that I don’t know all ISO 3166-1 country-codes by heart. So I pop open a Web browser, use my favorite search engine, and the rest, well, you know how that goes.
I’ve always thought it strange that the DNS, the huge, distributed, hierarchical database which contains all manner of “interesting stuff” doesn’t have a zone I can query for the names of the country codes; at least I haven’t found one (using my favorite search engine).
If I look at some of the text records published in the DNS for the ccTLDs I see very few which actually announce in which country they’re located. In fact, in all the TLDs I found only ten records that satisfied my curiosity:
So guess what? Yep. ;-) Now don’t complain: I know many people shudder at the thought of even more TXT records in the DNS, but there is a famous precedent. So without further ado, here’s a way for you to query the country name from a 2-letter country code:
"nl" by the 2-letter country-code you wish to query, of course.
I picked up on Maik’s suggestion to add a few codes not in ISO 3166-1 and if you have any suggestions or wishes, feel free to speak up. And if anybody feels like providing a list of geo-coordinates per country-code (capital city, maybe?), we might be able to make something nice. ;-)
I’ve implemented Tony Finch’s suggestion to redirect from
CC.cc.jpmens.net to the TLD’s registry, not only for the ccTLDs but for all 310+ TLDs; COM, XXX, the IDN (internationalized) TLDs, and of course the ccTLDs, etc. should all work.
- If you visit cc.jpmens.net you’ll be prompted for a TLD; enter it and be beamed over to the responsible NIC if there is one. (Some TLDs don’t have their own NIC in which case we direct you to IANA’s whois server.)
- If you visit, say, be.cc.jpmens.net you’ll be directed automatically.
"be"by the TLD you’re interested in.)
Unless I fidget too much with it, this interface ought to remain pretty stable.