Rfc3492Idn implements Idn { public String toUnicode(String punycode) { StringBuilder unicode = new StringBuilder(punycode.length()); StringTokenizer tok = new StringTokenizer(punycode, "."); while (tok.hasMoreTokens()) { String t = tok.nextToken(); if (unicode.length() > 0) unicode.append('.'); if (t.startsWith(ACE_PREFIX)) t = decode(t.substring(4)); unicode.append(t); } return unicode.toString(); }  String toUnicode(String punycode);  }
@Test public void testToUnicode() throws Exception { Rfc3492Idn idn = new Rfc3492Idn(); Assert.assertEquals("\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" + "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", idn.toUnicode("xn--egbpdaj6bu4bxfgehfvwxn")); Assert.assertEquals("www.z\u00fcrich.ch", idn.toUnicode("www.xn--zrich-kva.ch")); Assert.assertEquals("www.g\u00e4ggelig\u00e4\u00e4l.ch", idn.toUnicode("www.xn--gggeligl-0zaga.ch")); }