1.通过sql直接转换
select CONVERT (*** USING utf8) AS userName from usertable;
2.通过程序转换(注:本例用的是springmvc包装并返回结果集)
String srt2; try { srt2 = new String((byte[])entry.getValue(),"UTF-8"); hashmap.put(entry.getKey().toString(), srt2); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
原文链接:https://www.cnblogs.com/renjie0520/p/5242350.html
文章评论