Chirag Dj
Chirag Dj

Reputation: 630

How to Decode HTML Entities (“
” and " £") from string in xcode

in xml data is

<content_special>
    SAT 17TH TEST test club cheap drinks £3 shots £5 bottles $beers
</content_special>

i get this string using this code

TBXMLElement *Content_Special=[TBXML childElementNamed:@"content_special" parentElement:Club];
            NSString *Content_SpecialStr = [TBXML textForElement:Content_Special];

when i NSLog(@"Content_special:%@",Content_SpecialStr);

that print like this

 Content_special:SAT 17TH TEST&#13;
test club&#13;
cheap drinks&#13;
&#13;
&#163;3 shots&#13;
&#163;5 bottles&#13;
&#13;
$beers

how can i get original sting which Display in Xlm ? Any suggestion...

Upvotes: 1

Views: 2353

Answers (2)

Chirag Dj
Chirag Dj

Reputation: 630

Found Solution Using Google Toolbox for Mac GTMNSString+HTML.h ,GTMNSString+HTML.m And GTMDefines.h,

First #import "GTMNSString+HTML.h"

use like This: Content_SpecialStr = [Content_SpecialStr gtm_stringByUnescapingFromHTML];

Upvotes: 3

coneybeare
coneybeare

Reputation: 33101

Ensure your data xml file has utf-8 encoding http://www.w3schools.com/xml/xml_encoding.asp

Upvotes: 0

Related Questions