ios - What is the difference between stringByAddingPercentEscapesUsingEncoding: and stringByReplacingPercentEscapesUsingEncoding: -
What impresses difference between the two methods I have read many times and still have not found it. In addition, is there a way to force those methods to "sign" the signals? ? I have a base64 encoded (ie letters, numbers, plus slash) menu to urlencode and * Actually there is no Unicode, but the encoding you have selected. Example: Here is the output: loss: Workaround: Instead Foundation function Source: stringByAddingPercentEscapesUsingEncoding: and
stringByReplacingPercentEscapesUsingEncoding: ?
Using ended CFURLCreateStringByAddingPercentEscapes instead of the method of the above methods ...
- (NSString *) urlencode: (NSString *) str {return (NSString *) CFBridgingRelease (CFURLCreateStringByAddingPercentEscapes (zero, (CFStringRef __bridge) str, zero, CFSTR ( "+ / "), KCFStringEncodingUTF8)); }
Stringbraidlingprsapapsupingincoding Unicode * will change the character percent Escape format.
stringByReplacingPercentEscapesUsingEncoding will work in the opposite, save the percentage save in Unicode *.
NSString * rawText = @ "One Broadway, Cambridge, MA"; NSString * encodedtext = [raw text stringbearingadditionalprint espressoup encoding: NSUFF 8 string encoding]; NSLog (@ "encoded text:% @", encoded text); NSSTING * Decoded Text = [Encoded Text String ByerPlacing Pest Control Escoding Usage: NSTF 8 String Encoding]; NSLog (@ "original text:% @", decoded text);
encoded text: a 20% border, 20% of Cambridge,% 20MA text: Broadway, Cambridge, MA
stringByAddingPercentEscapesUsingEncoding not account ???? T encoded; ampersand safe characters (& amp) and the slash (/)
CFURLCreateStringByAddingPercentEscapes uses.
Comments
Post a Comment