VASmalltalk – ICU and IDNA

With version 0.0.15 I added initial support for IDNA using ICU under VASmalltalk. Though I added more wrapped API calls in this area, it turned out, that only two calls are mostly needed for daily-work (or at least i assume so).

IDNA helps you to handle domain names with non-ASCII characters like e.g. “www.bü”.

IDNA API’s allows you to convert a domain name with none-ASCII characters into domain names with ASCII characters only, which may then be used for DNS queries.

As an example – there is a domain called “www.bü”.

'www.bü' idnaNameToASCII

gives you a new string: ‘’, which can be used for DNS queries. To get the original URL back you simple execute:

'' idnaNameToCCP

which brings you “www.bü” back (in the current code page of VASmalltalk, here CP-819). Of course by using #idnaNameToCCP I assume, that the original URL can be shown in the current code page. That may not always be possible and therefore you may wish to get a general Unicode based string:

'' idnaNameToUnicode

and you get the same result, but now you get an instance of ICUUnicodeString (a new subclass of DBString I introduced with the ICU package) holding Unicode code points. There are also wrapped API calls for UTF8 handling, but I have not tested them yet.

Some new helper methods are also now available – creating DBStrings from an array of code points.

ICUUnicodeString fromCodePoints:  #[ 16r0078 16r006E 16r002D 16r002D 16r0062 16r0063 16r0068 16r0065 16r0072 16r002D 16r006B 16r0076 16r0061 ].

which is “www.bü”.

This entry was posted in Smalltalk and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s