解决方案 »

  1.   

    URL带中文必须先编码,可以用下面的方法转码,在请求就可以了
    //url编码(ARC)
    + (NSString *)urlEncodingString:(NSString *)origion {
        NSString *encoded = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                                                (CFStringRef)origion,
                                                                                NULL,
                                                                                (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                                                kCFStringEncodingUTF8));
        return encoded;
    }
      

  2.   

    按你这么来连www.baidu.com都打不开
      

  3.   

    网址带中文,肯定是要编码的。而且一般url编码采用UTF-8,最好只对中文编码,英文不要去编码
      

  4.   

    这个很容易阿。 
    这样就好了NSString* urlString = @"http://.........";
        urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSURL *url = [NSURL URLWithString:urlString];
      

  5.   

    网址带中文,肯定是要编码的。而且一般url编码采用UTF-8,最好只对中文编码,英文不要去编码 
    光中文也不好使呀    你们试试谁能把   http://8.中国   打开
      

  6.   

    这个应该是网址解析的问题吧。
    当使用比如这个网址:http://www.baidu.com/s?wd=二维码&rsv_spt=1&issp=1,经过 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding 把中文转换成UTF8,就可以使用webView打开。
    而这个 http://8.中国 地址经过 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding 编码之后,走webView代理中的失败方法。错误为:Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x16e4f180 {NSErrorFailingURLStringKey=http://8.%e4%b8%ad%e5%9b%bd/, NSErrorFailingURLKey=http://8.%e4%b8%ad%e5%9b%bd/, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0x16e4ed90 "A server with the specified hostname could not be found."}