views:

9

answers:

1

Hi all,

I am trying to open an url with in the application. It has some special characters like, ./_ =| | #. It is not opened when I try to open it with in the application like [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneUrl]]; but it is not responding. When I Pasted the url in safari of simulator it is working fine. I don't know where the problem is. Can you guys please help on this.

Thanks in Advance. Sekhar

A: 

Try to add percent escapes for characters illegal in URLs:

NSString* escapedPhoneUrl = [phoneUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:escapedPhoneUrl]];
Vladimir
@ Valdimir: Thanks for the quick reply.But I had a problem when using NSString* escapedPhoneUrl = [phoneUrl stringByAddingPercentEscapesUsingEncoding:NSUTF*StringEncoding];but it is throwing some 2 errors like,1. 'NSUTF' undeclared.2. 'StringEncoding' undeclared.
Sekhar
@ Vlaidmir: it is working fine when I used NSUTF8StringEncoding.
Sekhar
yes, sorry - that was a typo
Vladimir