1

I have strings that I download from the web that look like this:

משה פרץ

How can I get the real string from this string?

user unknown
  • 35,537
  • 11
  • 75
  • 121
YosiFZ
  • 7,792
  • 21
  • 114
  • 221

2 Answers2

1

You could try the GTMNSString+HTML class developed by Google. Specifically, the method:

/// Get a string where internal characters that are escaped for HTML are unescaped 
//
///  For example, '&' becomes '&'
///  Handles   and 2 cases as well
///
//  Returns:
//    Autoreleased NSString
//
- (NSString *)gtm_stringByUnescapingFromHTML;

Github (Michael Waterfall) - actually from Google Toolbox for Mac - may or may not be compatible with iOS.

Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144
1

The string you are getting from the web contains HTML entities (i.e: מ). You could manually detect and capture the hexadecimal values (ie: 0x5DE in this case) and feed it to a NSMutableString.

This other question might have other useful options for you: Objective-C: How to replace HTML entities?

Community
  • 1
  • 1