Java 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 java.io.UnsupportedEncodingException;

public class Main {
    public static String toUtf8(String str) {
        String val = "";

        try {/*from  w  w  w.  j  a  v  a  2s .  c  o  m*/
            val = new String(str.getBytes("UTF-8"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return val;
    }
}

Related

  1. toUTF8(String isoString)
  2. toUTF8(String s)
  3. toUTF8(String sourceStr)
  4. toUTF8(String str)
  5. toUTF8(String str)
  6. toUTF8(String str)
  7. toUTF8(String string)
  8. toUTF8(String value)
  9. toUTF8ByteArray(char[] string)