Nil
Nil

Reputation: 65

Non english character in NSString

In my application server give response text in non English characters. I parse this data and store this in string.

I want string operation on this string but due to non English characters, I got error and crash.

Specially this happen when hindi characters available in response.

Please help me.

Thanks in advance.

Upvotes: 0

Views: 354

Answers (1)

RK-
RK-

Reputation: 12211

The problem could be with the way your are getting the data from the server and storing it in the NSString. You might be decoding your data with ASCII characterset.

Try with this NSUTF8StringEncoding. This could solve your problem:

NSString *string =  [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

Upvotes: 1

Related Questions