" 1=1  and ( jobarea like '03__'  or jobarea like '37__' ) and (industrytype1 in ('01') or industrytype2 in ('01')) and ( (functype1 like '01__' or functype2 like '01__') ) and (issuedate>=sysdate-03) and is51job='1'"
如上一段字符串(不包括引号)在编码后为下面一段字符串
+1%3D1++and+%28+jobarea+like+%2703__%27++or+jobarea+like+%2737__%27+%29+and+%28industrytype1+in+
%28%2701%27%29+or+industrytype2+in+%28%2701%27%29%29+and+%28+%28functype1+like+%2701__%27+or+functype2+like+%2701__%27%29+"广东省"编码后为 %B9%E3%B6%AB%CA%A1
这些都是在51job上看到的东西,我无论用
Server.HtmlEncode();
还是
Server.UrlEncode();
都无法实现同样的效果,各位能否告知用什么样的方法可以实现同样的效果!
非常感谢!

解决方案 »

  1.   

    采用不同编码UrlEncode后的字符串不同eg:
    string tmp1 = System.Web.HttpUtility.UrlEncode("活靶子", System.Text.Encoding.GetEncoding("GB2312"));
    string tmp2 = System.Web.HttpUtility.UrlEncode("活靶子", System.Text.Encoding.UTF8);
      

  2.   

    string tmp1 = System.Web.HttpUtility.UrlEncode("活靶子", System.Text.Encoding.GetEncoding("GB2312"));
    正解,不过要注意的是有些特殊字符还是需要ToLower()然后再对比而且特殊字符有的可能会不编码,这个规律要你自己来寻找了,如果只是汉字应该没问题。
      

  3.   

    非常谢谢 xiahouwen(武眉博<活靶子.NET>) 
    确实是编码的问题,
    可是现在还有一个问题
    就是使用  System.Web.HttpUtility.UrlEncode(aa,System.Text.Encoding.GetEncoding("GB2312"));
    无法将 ( 和 ' 转换为 %28%27而System.Web.HttpUtility.UrlDecode(aa,System.Text.Encoding.GetEncoding("Gb2312"));
    又可以吧%28%27转换为(  和'
    这是为什么??
      

  4.   

    是不是要指定Encodingutf-8 or gb2312