0

I have searched the website for answer without result so here I am with a question.

I am using CouchDB and i'm going to use a view but the problem is that I can't use quotation mark (") in an NSURL when I'm creating a url for NSURLConnection.

Here's my code:

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://127.0.0.1:5984/users/_design/search/_view/phone?key=\"0701010100\""]];

CouchDB thinks it's a number if I don't use these quotation marks.

Thanks to all for your help.

Marcus

rishi
  • 11,779
  • 4
  • 40
  • 59
mBrissman
  • 136
  • 5

1 Answers1

1

use -stringByAddingPercentEscapesUsingEncoding:

NSURL *url = [NSURL URLWithString:[[NSString stringWithFormat:@"http://127.0.0.1:5984/users/_design/search/_view/phone?key=\"0701010100\""] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117
  • Thanks for answer! I did it by typing %%22 before and after the key-value. But I think I will use your code instead. ;) – mBrissman May 19 '12 at 15:54