url上的中文字符是ISO-8859-1。后台獲取中文亂碼解決問題。
需要轉碼
public static String changeCharset(String str, String defaultValue)
{
if (str != null)
{
try
{
if ((StringUtils.isNotBlank(str)) && str.equals(
new String(str.getBytes("ISO-8859-1"), "ISO-8859-1")))
{
return new String(str.getBytes("ISO-8859-1"), "UTF-8");
}
return str;
}
catch (UnsupportedEncodingException e)
{
throw new RuntimeException("字符串轉換異常!!!!");
}
}
return defaultValue;
}
