zoukankan      html  css  js  c++  java
  • java接收中文输入并正常显示

    class chinese
    {
     public static void main(String[] args)
     {
        byte []by=new byte[64];
                     String temp="";
                     int len=0;

                     try {
                         len=System.in.read(by);  
                         byte []byt=new byte[len];
                         for (int i = 0; i < len; i++) {
                             byt[i]=by[i];
                         }

                                     temp=new String(byt);
                                    
                                  //   temp=new String(temp.getBytes("UTF8 "),"UTF8");
                                     }
                                     catch (Exception ex) {
                         System.out.println("ex:"+ex.getMessage());
                     }
                                     System.out.print(temp);

     }
    }

  • 相关阅读:
    Tools
    Python
    Python
    Python
    Python
    Python
    linux下搭建SVN服务器完全手册【摘抄】
    XPath学习:轴(14)——总结
    XPath学习:parent,child
    使用Xpath对XML进行模糊查询
  • 原文地址:https://www.cnblogs.com/ahuo/p/610306.html
Copyright © 2011-2022 走看看