I have to access a web server using a GET
with international characters (Hebrew in my case but could be anything).
So I make an NSString
just fine but
[NSURL URLWithString:urlString]; // returns nil.
I realize I probably have to convert the international characters to percent codes.
Is there a built in method in Objective-c to do so?
Yes there is, you need -stringByAddingPercentEscapesUsingEncoding:
method:
[NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With