阅读背景:

java 任意转码到UTF-8 (注:仅平台下原始字符串)

来源:互联网 

public static String xxx2utf(String string) {
    	byte[] UTFByte = null;
		try {
			UTFByte = new String(string.getBytes(), Charset.defaultCharset().toString())  
			.getBytes("UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}  
    	String aimStr = null;
		try {
			aimStr = new String(UTFByte, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}  
    	return aimStr;
    }public static String xxx2utf(String string) 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: