+ (NSString *) Stringbyreplaceunicode: (NSString *)string{nsmutablestring*convertedstring = [stringMutablecopy]; [Convertedstring replaceoccurrencesofstring:@"\\u"Withstring:@"\\u"Options0Range:nsmakerange (0, Convertedstring.length)]; Cfstringref Transform= Cfstr ("Any-hex/java"); Cfstringtransform ((__bridge cfmutablestringref) convertedstring, NULL, transform, YES); returnconvertedstring;}-(NSString *) urlencodedstring{NSString*encodedstring = (NSString *) Cfbridgingrelease (Cfurlcreatestringbyaddingpercentescapes (Kcfallocatordefault, (Cfstringref) Self, NULL, (CFSTRINGREF)@"!* ' ();: @&=+$,/?%#[]", kCFStringEncodingUTF8)); returnencodedstring;}-(NSString *) urldecodedstring{NSString*decodedstring= (__bridge_transfer NSString *) cfurlcreatestringbyreplacingpercentescapesusingencoding (NULL, (__ Bridge Cfstringref) Self, cfstr (""), cfstringconvertnsstringencodingtoencoding (nsutf8stringencoding)); returndecodedstring;}
Unicode decoding, URL encoding/decoding