Skip to content

NSASCIIStringEncoding in parameters function in NSMutableURLRequest+Parameters.m causing crash when contains unicode data? #22

@AKPHYO

Description

@AKPHYO

Put any Unicode string in OAMutableURLRequest httpbody data,the library will crash in this function call.
NSArray *parameters = [self parameters] in the following code.

  • (NSString *)_signatureBaseString {
    // OAuth Spec, Section 9.1.1 "Normalize Request Parameters"
    // build a sorted array of both request parameters and OAuth header parameters
    NSDictionary *tokenParameters = [token parameters];
    // 6 being the number of OAuth params in the Signature Base String
    NSArray *parameters = [self parameters];

I checked and found NSASCIIStringEncoding is being used in two places in the following functions in this file NSMutableURLRequest+Parameters.m

  • (NSArray *)parameters {
    ...
  • (void)setHTTPBodyWithString:(NSString *)body {
    ...

. I think they should be NSUTF8StringEncoding. I changed and tested. no crash anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions