Home Tutorial Java Corejava Convert String to unicode and ascii

 
 

Share on Google+Share on Google+
Convert String to unicode and ascii
Posted on: April 15, 2010 at 12:00 AM
Advertisement
This tutorial demonstrate how a simple string can be converted to ascii and unicode.

Description:

This example demonstrate how to convert the general string to unicode and ascii type

Code:

import java.net.IDN;

public class ChangeIdnType {
  public static void main(String[] args) {
    String general = "www.myWebsite.com";
    String ascii = IDN.toASCII(general);
    String unicode = IDN.toUnicode(general);

    System.out.println("General Format:" + general);
    System.out.println("Ascii Format):" + ascii);
    System.out.println("Unicode Format:" + unicode);
  }
}

Output:

Advertisement

Related Tags for Convert String to unicode and ascii:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 15, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com