Be careful not to leak memory during conversions when using CFStringRef. This is what I came up with for working with Latin characters and others. I use this to avoid my options, not the entire URL. Depending on your use case, you may need to add or remove characters from "escapeChars"
CFStringRef escapeChars = (CFStringRef)@"%;/?¿:@&=$+,[]#!'()*<>¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ \"\n"; NSString *encodedString = (__bridge_transfer NSString *) CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge_retained CFStringRef) url, NULL, escapeChars, kCFStringEncodingUTF8);
Hope this helps.
NullԀʇɹ 92065
source share