try {
        // Construct a x-www-form-urlencoded string
        String line = URLEncoder.encode("name1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
        line += "&" + URLEncoder.encode("name2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
    
        // Parse a x-www-form-urlencoded string
        String[] pairs = line.split("\\&");
        for (int i=0; i<pairs.length; i++) {
            String[] fields = pairs[i].split("=");
            String name = URLDecoder.decode(fields[0], "UTF-8");
            String value = URLDecoder.decode(fields[1], "UTF-8");
        }
    } catch (UnsupportedEncodingException e) {
    }

解决方案 »

  1.   

    myth822(枫红一刀) 
    兄弟什么意思啊
      

  2.   

    public static String getUtf8Str(String s){
            String ret=null;
            try {
                ret=java.net.URLEncoder.encode(s, "utf-8");
            } catch (UnsupportedEncodingException ex) {
            }
            return ret;
        }
      

  3.   

    omtf(心无挂碍) 
    这个试过了 好像也有问题 
    现在的问题是 汉字 ->UTF-8 乱码  这个过程可能有字符被过滤 或者字节变化
      

  4.   

    我是用UltraEdit打开之后然后把里面的页面属性(charset)改为utf-8然后另存,选择utf-8覆盖原来的文件来解决的。
      

  5.   

    encode 汉字->utf8
    decode utf8->汉字