iOS解码umlaut&$

iOS解码umlaut&$,ios,nsstring,decode,diacritics,Ios,Nsstring,Decode,Diacritics,我有一个需要解码的示例: @“für” 如何将其解码为NSString,使其看起来像 fūr 我尝试了很多东西,包括 [@"f&#252r" stringByDecodingHTMLEntities] > f&#252r [@"f&#252r" gtm_stringByUnescapingFromHTML] > f&#252r 但是没有运气 谢谢 基于vikingosegundo解决方案的更新 NSLog(@"möchte d

我有一个需要解码的示例:

@“für”

如何将其解码为NSString,使其看起来像

fūr

我尝试了很多东西,包括

[@"f&#252r" stringByDecodingHTMLEntities] > f&#252r  
[@"f&#252r" gtm_stringByUnescapingFromHTML] > f&#252r  
但是没有运气

谢谢

基于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&#246chte decoded:%@", [@"m&#246chte" stringByDecodingHTMLEntitiesComma] );
    NSLog(@"f&#252r decoded:%@", [@"f&#252r" 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&#246chte decoded:möchte
f&#252r decoded:für
注: stringByEncodingHTMLEntities来自 StringByDecodingHtmlenties逗号来自vikingosegundo的类别。

试试看

[@"für" stringByDecodingHTMLEntities];

(注意


还可以解决缺少的

太棒了!谢谢将使用您的解决方案更新我的原始答案。
[@"für" gtm_stringByUnescapingFromHTML];