request.getCharacterEncoding()
如果没有经过编码则返回null

解决方案 »

  1.   

    转换:szSendMsg=new String(szSendMsg.getBytes("iso8859_1"),"gb2312");
      

  2.   

    只是当前请求的request使用的encoding @_@~
      

  3.   

    String temp0;
    String temp1;
    String pkg = "你的字符!"; 
    temp0 = pkg.getBytes("iso8859-1");
          temp1 = new String(temp0);
          if (pkg.equals(temp1)) {
            try {
              byte[] by = pkg.getBytes();
              pkg = new String(by, "GBK");
            }
            catch (Exception e) {
              pkg = "can not trans to GBK";
            }
          }