java中文乱码解决方法汇总

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中文乱码解决方法汇总,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。