转码GBK;解码UTF-8

  /**
         * 转码
         */
//        String strGBK = null;
//        try
//        {
//            strGBK = URLEncoder.encode(jsonResult, "UTF-8");
//        }
//        catch (UnsupportedEncodingException e1)
//        {
//            // TODO Auto-generated catch block
//            e1.printStackTrace();
//        }  
//        System.out.println(strGBK);

        /**
         * 解码
         */
//        String strUTF8 = null;
//        try
//        {
//            strUTF8 = URLDecoder.decode(jsonResult, "UTF-8");
//        }
//        catch (UnsupportedEncodingException e1)
//        {
//            // TODO Auto-generated catch block
//            e1.printStackTrace();
//        }  
//        System.out.println(strUTF8); 

 

posted @ 2018-12-20 10:25  百事没事  阅读(779)  评论(0编辑  收藏  举报