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());
        }
     
    }
  • 相关阅读:
    单点登录的实现原理
    Entity Framework添加记录时获取自增ID值
    linq to entity查询,日期格式化
    Linq之GroupBy用法
    IIS HTTPS CA
    CallContext和多线程
    windows平台 culture name 详细列表
    如何在WCF中集成unity
    .NET MVC 依赖注入 来龙去脉
    apache虚拟主机安装注意事项
  • 原文地址:https://www.cnblogs.com/husam/p/3758283.html
Copyright © 2011-2022 走看看