首页 > 编程语言 > 详细

java中文乱码解决方法汇总

时间:2014-05-29 20:24:36      阅读:467      评论:0      收藏:0      [点我收藏+]

publicstaticvoidmain(String[]argv){

try{
    
           System.out.println(“中文”);//1
 
           System.out.println(“中文”.getBytes());//2
 
           System.out.println(“中文”.getBytes(GB2312));//3
 
           System.out.println(“中文”.getBytes(ISO8859_1″));//4
          
 
           System.out.println(newString(“中文”.getBytes()));//5
 
           System.out.println(newString(“中文”.getBytes(),GB2312));//6
 
           System.out.println(newString(“中文”.getBytes(),ISO8859_1″));//7
 
           System.out.println(newString(“中文”.getBytes(GB2312)));//8
 
           System.out.println(newString(“中文”.getBytes(GB2312),GB2312));//9
          
 
           System.out.println(newString(“中文”.getBytes(GB2312),ISO8859_1″));//10
 
           System.out.println(newString(“中文”.getBytes(ISO8859_1″)));//11
 
           System.out.println(newString(“中文”.getBytes(ISO8859_1″),utf-8));//12
 
           System.out.println(newString(“中文发送短信”.getBytes(ISO8859_1″),utf-8));//13
          
           //编码与解码
           Stringcont=URLEncoder.encode(newString(“你在干什么啊  33335),utf-8);
           System.out.println(0:”+cont);          
           Stringafter=URLDecoder.decode(cont,utf-8);
           System.out.println(1:”+after);
          
      }catch(Exceptione){
    System.out.println(e.getMessage());
    }
 
}

java中文乱码解决方法汇总,布布扣,bubuko.com

java中文乱码解决方法汇总

原文:http://www.cnblogs.com/husam/p/3758283.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!