views:

23

answers:

1

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];

return 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?

+2  A: 

Yes there is, you need -stringByAddingPercentEscapesUsingEncoding: method:

[NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
Vladimir