Java UTF8 Encode encodeToUTF8(String str)

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

Description

encode To UTF

License

Open Source License

Declaration

public static String encodeToUTF8(String str) throws UnsupportedEncodingException 

Method Source Code


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

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

public class Main {

    public static String encodeToUTF8(String str) throws UnsupportedEncodingException {
        return encode(str, StandardCharsets.UTF_8.name());
    }/*  w w w .j  a  va2s . c  o  m*/

    public static String encode(String str, String charsetName) throws UnsupportedEncodingException {
        return new String(str.getBytes(), charsetName);
    }
}

Related

  1. encodeSignatureUtf8(byte[] sig)
  2. encodeStringUtf8(String text)
  3. encodeUtf8(byte[] bytes)
  4. encodeUTF8(byte[] bytes)
  5. encodeUTF8(String str)
  6. encodeUTF8(String str)