编码转换

/*@*/
            String charset="UTF-16BE;UTF-16LE;ISO-8859-1;UTF-16;UTF-8;GBK;GB2312;GB18030;US-ASCII"; //字符编码集合

             String []arrayCharset=charset.split(";");     //分隔为字符编码数组

             for(int fromIndex=0;fromIndex<arrayCharset.length;fromIndex++){

               for(int toIndex=0;toIndex<arrayCharset.length;toIndex++) {

      String valueOfParameter=new String(

      request.getParameter("username").getBytes(arrayCharset[fromIndex])

      ,arrayCharset[toIndex]); //进行转换

      System.out.println(arrayCharset[fromIndex]+"->"+arrayCharset[toIndex]

      +":"+ valueOfParameter); //输出到服务器系统输出日志

                }

          }
            /* end*/
            
原文地址:https://www.cnblogs.com/tianyuxuepiao/p/2676786.html