NSURLRequest with a URL containing special characters

I have the same problem as: NSURL with special characters

But I tried to solve them. Unable to get my NSURLRequest to work with åöä characters. If the string variable contains åöä, the query returns null. Also tried with NSISOLatin1StringEncoding.

NSString *encodedString = [string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *urlString = [NSString stringWithFormat: @"http://suggestqueries.google.com/complete/search?output=firefox&q=%@", encodedString]; NSURL *url = [NSURL URLWithString: urlString]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; 

This works: http://suggestqueries.google.com/complete/search?output=firefox&q=%C3%A5%C3%B6%C3%A4 (åöä)

Any ideas?

EDIT: Using the debugger, NSURL looks right:

 string __NSCFString * @"åäö" 0x0a77cd60 encodedString __NSCFString * @"%C3%A5%C3%A4%C3%B6" 0x0a77fc40 url NSURL * @"http://suggestqueries.google.com/complete/search?output=firefox&q=%C3%A5%C3%A4%C3%B6" 0x0a79d1f0 

It is resolved . The problem is not NSURL, as the interpretation of the returned NSDATA.

0
objective-c nsurl nsurlrequest
Jun 26 '14 at 7:20
source share

No one has answered this question yet.

See similar questions:

64
Where is the Google Suggest API documentation located?
7
NSURL with special characters

or similar:

1180
How to check if a string contains another string in Objective-C?
19
A reliable way to compare two NSURLs or one NSURL and NSString?
6
POST request for iphone Json to Django server creates QueryDict in QueryDict
one
how to send variable to php from c object
0
Getting "__NSArrayI stringByReplacingOccurrencesOfString: withString:"
0
Swift - using the << "operator in a REST api search using NSURLRequest
0
Wkwebview does not load new request URL
0
Download NSURL after reading the url in a text file in iOS?
-four
Problems with NSURL and NSString



All Articles