IDN.toASCII(String s) : Internationalized Domain Names « I18N « Java Tutorial






import java.net.IDN;

public class IDNDemo {
  public static void main(String[] args) {
    String input = "www.yourName.com";
    String ascii = IDN.toASCII(input);
    String unicode = IDN.toUnicode(input);

    System.out.println("Input:"+ input);
    System.out.println("toAscii (input):"+ ascii);
    System.out.println("toUnicode (input):"+ unicode);
  }
}








13.7.Internationalized Domain Names
13.7.1.Internationalized Domain Names (IDNs)
13.7.2.IDN.toASCII(String s)
13.7.3.IDN.toUnicode(String s)