Eclipse中utf-8的类文件:
String str="<综艺娱乐>";
String fep=System.getProperty("file.encoding");//gbk2312
String defaultLnaguage = System.getProperty("user.language"); //zh
String utf_162=new String (str.getBytes("UTF-16LE"));
System.out.println("转为UTF-16LE2:"+utf_162);
String ori2=new String (utf_162.getBytes(),"UTF-16LE");
System.out.println("从UTF-16LE2转回来:"+ori2);//不正常
////////////////////////////////////////////////////////////////////////
String str="<海外电影>";
String utf_162=new String (str.getBytes("UTF-16LE"));
System.out.println("转为UTF-16LE2:"+utf_162);
String ori2=new String (utf_162.getBytes(),"UTF-16LE");
System.out.println("从UTF-16LE2转回来:"+ori2);//正常显示<综艺娱乐>
中文经过uft-16le编码后,有时可以编回来,有时不能编回来,是什么原因?
String str="<综艺娱乐>";
String fep=System.getProperty("file.encoding");//gbk2312
String defaultLnaguage = System.getProperty("user.language"); //zh
String utf_162=new String (str.getBytes("UTF-16LE"));
System.out.println("转为UTF-16LE2:"+utf_162);
String ori2=new String (utf_162.getBytes(),"UTF-16LE");
System.out.println("从UTF-16LE2转回来:"+ori2);//不正常
////////////////////////////////////////////////////////////////////////
String str="<海外电影>";
String utf_162=new String (str.getBytes("UTF-16LE"));
System.out.println("转为UTF-16LE2:"+utf_162);
String ori2=new String (utf_162.getBytes(),"UTF-16LE");
System.out.println("从UTF-16LE2转回来:"+ori2);//正常显示<综艺娱乐>
中文经过uft-16le编码后,有时可以编回来,有时不能编回来,是什么原因?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货