1

Possible Duplicate:
Convert Unicode character to NSString

After parsing data from a website, the result was an object that contains Unicode and I want to convert it to NSString (the Unicode contains Hebrew characters mostly).

Here is some (small fraction) of the Unicode in the Log:

"\U05f3\U009e\U05f3\U00a2\U05f3\U2022"

How can I convert it?

Community
  • 1
  • 1
oridahan
  • 574
  • 1
  • 7
  • 20
  • The problem is that most of the characters that I'm converting from is in Hebrew so it's a different problem – oridahan Jan 22 '13 at 12:16

1 Answers1

0

You need to convert it into data and then to string.

char *yourObject=...;
NSData *unicodeData=[NSData dataWithBytes:yourObject
                                     length:strlen(yourObject)];
NSString *string = [[NSString alloc] initWithData:unicodeData           
                                         encoding:NSUTF8StringEncoding];
Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
  • Thanks, when I'm converting an Hebrew char it shows a dot instead of a character, any idea how can I convert it properly? – oridahan Jan 22 '13 at 13:57
  • Sorry I cant find the solution, you can check here http://stackoverflow.com/questions/1775859/how-to-convert-a-unichar-value-to-an-nsstring-in-objective-c – Anoop Vaidya Jan 22 '13 at 14:28