zoukankan      html  css  js  c++  java
  • 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());
        }
     
    }
  • 相关阅读:
    nodejs使用superagent写爬虫dns超时
    react部署nginx刷新路由404
    ubuntu安装mongodb添加账户以及远程连接
    laravel使用layui富文本编辑器layedit上传图片419解决办法
    编写前端统计网页流量,来源,停留时间等
    laravel模版共用数据解决方法
    解决MySQL导入中文乱码
    yii2 jui DatePicker widget 设置显示默认时间
    装饰器
    python函数计时器(通过装饰器实现)
  • 原文地址:https://www.cnblogs.com/husam/p/3758283.html
Copyright © 2011-2022 走看看