问题
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
test club
cheap drinks
£3 shots
£5 bottles
$beers
how can i get original sting which Display in Xlm ? Any suggestion...
回答1:
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];
回答2:
Ensure your data xml file has utf-8 encoding http://www.w3schools.com/xml/xml_encoding.asp
来源:https://stackoverflow.com/questions/18549045/how-to-decode-html-entities-13-and-163-from-string-in-xcode