Hi net-dev, If a Java application tries to support International Domain Names (IDN) [1], which was firstly brought in Java6, it has to write additional code or wrap java.net.IDN API [2] to make the conversion each time it tries to resolve a non-ASCII domain name, and use the converted punycode to make connections to remote host, like:
java.net.IDN.toASCII("电脑.info <http://xn--wnyy6w.info>"); It is easier for newly writen applications, since a wrappers can be made in early design stage, but if it comes to existing Java applications and third-party libraries, IDN support would involve much more effort like modifying the existing code base, inspecting libraries interfaces/implementations, or even re-implement some of the functions. I'm wondering if it is possible to add IDN support into existing Java APIs, like java.net.InetAddress.getByName(), if JDK itself supports IDN, any existing applications or libraries would benefit from supporting IDN automatically without any source code modifications. Of course there's security risks regarding IDN homograph attacks [1][2], so it may not be a good idea to change the default behavior right now. But it would still work if a simple switch can be added into current JDK. For example, by defining following the property in command like options like -Djava.net.AutoIDN=true Any existing Java applications who wishes to support IDN feature will be able to support IDN without any changes to its source code or re-compilation. What's your opinion on this ? any comment is welcome. Thank you - Jonathan Lu ----------- [1] http://en.wikipedia.org/wiki/Internationalized_domain_name [2] http://download.java.net/jdk8/docs/api/java/net/IDN.html [3] http://www.unicode.org/reports/tr36/ [4] http://en.wikipedia.org/wiki/IDN_homograph_attack