Convert String in gbk to String in UTF8 - Android Internationalization

Android examples for Internationalization:Chinese

Description

Convert String in gbk to String in UTF8

Demo Code

import java.io.UnsupportedEncodingException;

public class Main{

    public static String gbk2utf8(String gbk) {
        String utf8 = "";
        try {//from   w ww  . j  a v  a 2  s.  co m
            utf8 = new String(gbk.getBytes("ISO-8859-1"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return utf8;
    }

}

Related Tutorials