Convert string in ISO8859_1 encode to string in UTF8 encode - Android java.lang

Android examples for java.lang:String UTF-8

Description

Convert string in ISO8859_1 encode to string in UTF8 encode

Demo Code

import android.util.Log;

public class Main{


    public static String toUtf8(String str) {
        try {//from  w w w  .ja  va2  s  .co  m
            return new String(str.getBytes("ISO8859_1"), "UTF-8");
        } catch (Exception e) {
            Log.d("StringUtil-toUtf8", e.getMessage());
            return str;
        }
    }

}

Related Tutorials