在http URL等中,不能直接传送等号,会进行有urlencode。

+(NSString*)encodeString:(NSString*)unencodedString{


    // CharactersToBeEscaped = @":/?&=;+!@#$()~',*";

    // CharactersToLeaveUnescaped = @"[].";


    NSString *encodedString = (NSString *)

    CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,

                                                              (CFStringRef)unencodedString,

                                                              NULL,

                                                              (CFStringRef)@"!*'();:@&=+$,/?%#[]",

                                                              kCFStringEncodingUTF8));


    return encodedString;

}


//URLDEcode

-(NSString *)decodeString:(NSString*)encodedString


{

    //NSString *decodedString = [encodedString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding ];


    NSString *decodedString  = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL,

                                                                                                                     (__bridge CFStringRef)encodedString,

                                                                                                                     CFSTR(""),

}

你可能感兴趣的:(在http URL等中,不能直接传送等号,会进行有urlencode。)