Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

LinkedIn wants different characters escaped #24

Closed
pj4533 opened this issue Feb 19, 2013 · 3 comments
Closed

LinkedIn wants different characters escaped #24

pj4533 opened this issue Feb 19, 2013 · 3 comments

Comments

@pj4533
Copy link
Contributor

pj4533 commented Feb 19, 2013

I was having trouble in my AFLinkedInOAuth1Client class, and tracked down the issue to the escaping function in AFOAuth1Client. I changed it to this to get it working:

static NSString * AFPercentEscapedQueryStringPairMemberFromStringWithEncoding(NSString *string, NSStringEncoding encoding) {
    static NSString * const kAFCharactersToBeEscaped = @":/?&=;+!@#$(),";
    static NSString * const kAFCharactersToLeaveUnescaped = @"[].~";
//    static NSString * const kAFCharactersToBeEscaped = @":/?&=;+!@#$()~";
//    static NSString * const kAFCharactersToLeaveUnescaped = @"[].";

    return (__bridge_transfer  NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, (__bridge CFStringRef)kAFCharactersToLeaveUnescaped, (__bridge CFStringRef)kAFCharactersToBeEscaped, CFStringConvertNSStringEncodingToEncoding(encoding));
}

Ideally, I'd like to be able to override the escapable characters in my subclass. Does it make sense to move this static function to something that could be easily overridden? Or maybe make the kAFCharactersToBeEscape/LeaveUnescaped as properties on the client?

@notapplicableio
Copy link

How's this looking? Any movement?

@dlackty
Copy link

dlackty commented May 27, 2013

@pj4533 @trustyfrog This should be fixed in AFNetworking/AFNetworking@953b862

@mattt
Copy link
Contributor

mattt commented Aug 21, 2013

This has been addressed in AFNetworking, as well as 5c59bcd in this project. AFNetworking 2.0, thankfully, will use Apple-provided URL string encoding methods, and provide a first-class interface to customizing the parameter encoding to your requirements.

@mattt mattt closed this as completed Aug 21, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants