将中文乱码转换成utf-8的规范中文
1 import java.io.UnsupportedEncodingException; 2 3 4 public class LuanMa { 5 public static void main(String[] args) { 6 String msg = "鎮ㄧ殑楠岃瘉鐮佷负4532銆愮獫渚垮埄銆"; 7 String str=null; 8 try { 9 str = new String(msg.getBytes("GBK"),"UTF-8"); 10 } catch (UnsupportedEncodingException e) { 11 // TODO Auto-generated catch block 12 e.printStackTrace(); 13 } 14 System.out.println(str); 15 } 16 }