java.net.URLEncoder.encode("aaaaaaa\\'aaaa\\/");
    看行不行呀?

解决方案 »

  1.   

    public static String  java.net.URLEncoder.encode(String s)To convert a String, each character is examined in turn: 
        The ASCII characters 'a' through 'z', 'A' through 'Z', '0' through '9', and ".", "-", "*", "_" remain the same. (以上字符保持不变。)The space character ' ' is converted into a plus sign '+'. All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character. Since: JDK1.0
    你说的 “'”“/”等在转换范围内。
    以前把一个session的内容往cookie倒的时候碰到了“'”“,”写不进cookie的情况,用这个函数转了之后就行了。