PackageDescription: IDNA


IDNA

Last published: April 1, 2013 by 'nross'

Defines 2 Classes
Extends 3 Classes


RFC 3490 - Internationalizing Domain Names in Applications (IDNA), [http://www.ietf.org/rfc/rfc3490.txt]

Abstract

Until now, there has been no standard method for domain names to use characters outside the ASCII repertoire. This document defines internationalized domain names (IDNs) and a mechanism called Internationalizing Domain Names in Applications (IDNA) for handling them in a standard fashion. IDNs use characters drawn from a large repertoire (Unicode), but IDNA allows the non-ASCII characters to be represented using only the ASCII characters already allowed in so- called host names today. This backward-compatible representation is required in existing protocols like DNS, so that IDNs can be introduced with no changes to the existing infrastructure. IDNA is only meant for processing domain names, not free text.

LIMITATIONS

- doesn't do NAMEPREP preprocessing of strings
- doesn't properly implement all punycode failure modes
- needs exceptions instead of Errors
- needs I18N of messages

USAGE

You can convert an IDN using the IDNAEncoder as follows:

IDNAEncoder new encode: 'www.cincom.com'
==> 'www.cincom.com'
or
IDNAEncoder new encode: 'www.cìncòm.com'
==> 'www.xn--cncm-qpa2b.com'

and decode with

IDNAEncoder new decode: 'www.xn--cncm-qpa2b.com'
==> 'www.cìncòm.com'

This package also overrides the low level DNS access facilities to encode/decode the hostnames when necessary. Here's an example invocation including a Japanese web site.

host := (String with: 16r6c5f asCharacter with: 16r6238 asCharacter), '.jp'.
address := IPSocketAddress hostAddressByName: host.
==> [65 99 223 191]

The host name that is actually sent out to the DNS calls is:

IDNAEncoder new encode: host
==> 'xn--0ouw9t.jp'

A reverse lookup should also work, however I wasn't able to find an IP address that would successfully resolve to an IDN, so I wasn't able to test it.
Even our example gives me only the numeric result:

IPSocketAddress hostNameByAddress: address
==> '65.99.223.191'

I'd be obliged for any feedback on this package, please, send it to mkobetic@cincom.com.