/** * StringUtil.java[v 1.0.0] * class:com.bdyjy.util,StringUtil * �ܺ� create at 2016-4-21 ����5:45:47 */ package com.bdyjy.util; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; /** * com.bdyjy.util.StringUtil * * @author �ܺ�<br/> * create at 2016-4-21 ����5:45:47 */ public class StringUtil { /** * * @return * @throws UnsupportedEncodingException */ public static String transStr(String msg) { String res = null; try { res = new String(msg.getBytes("iso8859-1"), "utf-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return res; } /** * ���ַ���ת���ΪISO8859-1 * * @return */ public static String transStrToIso8859(String str) { String res = null; try { res = URLEncoder.encode(str, "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return res; } }