1
我有什麼,我需要解碼的例子:
@ 「F &#252R」
我怎樣才能得到這個解碼,以一個NSString所以它看起來像
毛皮
我嘗試了數個的包括
[@"für" stringByDecodingHTMLEntities] > für
[@"für" gtm_stringByUnescapingFromHTML] > für
但沒有運氣。
謝謝!基於vikingosegundo的解決方案
NSLog(@"möchte decoded to : > %@", [@"möchte" stringByEncodingHTMLEntities]);
NSLog(@"möchte decoded to: > %@", [@"möchte" stringByDecodingHTMLEntities]);
NSLog(@"für decoded to : > %@", [@"für" stringByEncodingHTMLEntities]);
NSLog(@"für decoded to: > %@", [@"für" stringByDecodingHTMLEntities]);
NSLog(@"möchte decoded:%@", [@"möchte" stringByDecodingHTMLEntitiesComma]);
NSLog(@"für decoded:%@", [@"für" stringByDecodingHTMLEntitiesComma]);
möchte decoded to : > möchte
möchte decoded to: > möchte
für decoded to : > für
für decoded to: > für
möchte decoded:möchte
für decoded:für
注
UPDATE: stringByEncodingHTMLEntities是從https://github.com/mwaterfall/MWFeedParser/tree/master/Classes stringByDecodingHTMLEntitiesComma是vikingosegundo的類別。
太棒了!謝謝。將使用您的解決方案完成我原來的答案。 – Zsolt