Here you can find the source of encodeUtf8(String target)
Parameter | Description |
---|---|
target | a parameter |
public static String encodeUtf8(String target)
//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; } }