change string Charset encoding - Android java.lang

Android examples for java.lang:String Unicode

Description

change string Charset encoding

Demo Code

import java.io.UnsupportedEncodingException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String changeCharset(String str, String from, String to)
            throws UnsupportedEncodingException {
        String newStr = null;//from   w  w  w . j  a  va2s .  co  m
        newStr = new String(str.getBytes(from), to);
        return newStr;
    }

}

Related Tutorials