Skip to content
Permalink
Browse files

[Issue #206] Replacing stringByAddingPercentEncodingWithAllowedCharac…

…ters with CFURLCreateStringByAddingPercentEscapes to prevent out-of-memory exception
  • Loading branch information...
mattt committed Nov 6, 2014
1 parent 66fde65 commit 28df82ec9c0115f43ee7f3dc371cf7a0cb84a587
Showing with 2 additions and 2 deletions.
  1. +2 −2 Source/Alamofire.swift
@@ -152,8 +152,8 @@ public enum ParameterEncoding {
}

func escape(string: String) -> String {
let allowedCharacters = NSCharacterSet(charactersInString:" =\"#%/<>?@\\^`{}[]|&+").invertedSet
return string.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacters) ?? string
let legalURLCharactersToBeEscaped: CFStringRef = ":/?&=;+!@#$()',*"
return CFURLCreateStringByAddingPercentEscapes(nil, string, nil, legalURLCharactersToBeEscaped, CFStringBuiltInEncodings.UTF8.rawValue)
}
}

0 comments on commit 28df82e

Please sign in to comment.
You can’t perform that action at this time.