Android UTF8 Encode toUtf8(String str)

Here you can find the source of toUtf8(String str)

Description

to Utf

License

Open Source License

Declaration

public static String toUtf8(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.util.Log;

public class Main {

    public static String toUtf8(String str) {
        try {//  w  w w . j  a 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

  1. utf8Encode(String str)
  2. utf8Encode(String str, String defultReturn)
  3. bytesUtf8(int c)
  4. bytes2StringUTF8(byte[] buf)
  5. bytes2StringUTF8(byte[] buf, int bufOffset, int bufLength, boolean bigEndian)
  6. bytes2charsUTF8(byte[] buf, int bufOffset, int bufLength, char[] cbuf, boolean bigEndian)