0

I have got small issue in my app.

I make NSMutableURLRequest and send body to my webserice.

jsonRequest = @"{\"s\":\"deón\"}";

NSData *requestData = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]];

I need change "ó" symbol to \u00F3.

Any idea?

3 Answers 3

1

I would suggest you another way around if you want to deploy on target >=iOS5. It involves more steps, but you can be sure about the correct result, it's less error prone.

NSDictionary * jsonDict = @{ @"s" : @"deón" };    
NSData * requestData = [NSJSONSerialization dataWithJSONObject:jsonDict options:0 error:nil];
Sign up to request clarification or add additional context in comments.

2 Comments

it for iOS 4.3, so i need solution for all version
I think that Vishal answer would be fine
0

convert in UTF-8

    NSData *data = [arrayString dataUsingEncoding:NSUTF8StringEncoding];

Comments

0

Try this code it will near to your requirement

 NSString *jsonRequest = @"{\"s\":\"deón\"}";

 const char *c = [jsonRequest cStringUsingEncoding:NSISOLatin1StringEncoding];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.