Internationalization of Network Resources

Domains: Java

In a modern Internet community, many users are no longer satisfied with using only ASCII symbols to identify a domain name or a web resource. For example, they would like to be able to register a new domain using their native characters in Arabic or Chinese. That is why the internationalization of network resources is a cornerstone in widening horizons for the World Wide Web.

This lesson describes the internationalization of the network Domain Name resources.

Internationalized Domain Name

Historically, an Internet domain name contained ASCII symbols only. As the Internet gained popularity and was adopted across the world, it became necessary to support internationalization of domain names, specifically to support domain names that include Unicode characters.

The Internationalizing Domain Names in Applications (IDNA) mechanism was adopted as the standard to convert Unicode characters to standard ASCII domain names and thus preserve the stability of the domain name system. This system performs a lookup service to translate user-friendly names into network addresses.

Examples of internationalized domain names:

  • http://清华大学.cn
  • http://www.транспорт.com

If you follow these links you will see that the Unicode domain name represented in the address bar is substituted with the ASCII string.

To implement similar functionality in your application, the class provides methods to convert domain names between ASCII and non ASCII formats.

Method Purpose
toASCII(String, flag)
Used before sending an IDN to the domain name resolving system or writing an IDN to a file where ASCII characters are expected, such as a DNS master file. If the input string doesn't conform to RFC 3490, these methods throw an IllegalArgumentException.
toUnicode(String, flag)
Used when displaying names to users, for example names obtained from a DNS zone. This method translates a string from ASCII Compatible Encoding (ACE) to Unicode code points. This method never fails; in case of an error the input string remains the same and is returned unmodified.

The optional flag parameter specifies the behavior of the conversion process. The ALLOW_UNASSIGNED flag allows including code points that are unassigned in Unicode 3.2. The USE_STD3_ASCII_RULES flag ensures that the STD-3 ASCII rules are observed. You can use these flags separately or logically OR'ed together. If neither flag is desired, use the single-parameter version of the method.

Similar pages

Page structure