Java UTF8 Encode encodeUtf8(String target)

Here you can find the source of encodeUtf8(String target)

Description

encode Utf

License

Open Source License

Parameter

Parameter Description
target a parameter

Return

target encode utf8

Declaration

public static String encodeUtf8(String target) 

Method Source Code


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

import java.io.UnsupportedEncodingException;

public class Main {
    /**//  w  w  w  .j av  a2  s. com
     * 
     * @param target
     * @return target encode utf8
     */
    public static String encodeUtf8(String target) {
        String result = null;
        try {
            result = new String(target.getBytes(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            System.err.println("ERROR! encode utf8 failed - " + e);
        }
        return result;
    }
}

Related

  1. encodeUtf8(byte[] bytes)
  2. encodeUTF8(byte[] bytes)
  3. encodeUTF8(String str)
  4. encodeUTF8(String str)
  5. encodeUtf8(String string)
  6. encodeUTF8(String text)
  7. encodeUTF8(String text)
  8. encodeUtf8(String url)
  9. getBufferedWriter(final File outFile, final String outEncoding)