Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ios中解码html数据?_Html_Ios_Objective C_Decoding - Fatal编程技术网

如何在ios中解码html数据?

如何在ios中解码html数据?,html,ios,objective-c,decoding,Html,Ios,Objective C,Decoding,我有以下表格中的数据: %3Cp%3E%3Cstrong%3Ee-AWB+and+e 我必须解码并显示在Webview/UILabel中 我试过这个-,但它对我不起作用使用这个- - (NSString *)URLDecode:(NSString *)htmlString { NSString *decodedURL = [htmlString stringByReplacingOccurrencesOfString:@"+" withString:@" "]; decoded

我有以下表格中的数据:

%3Cp%3E%3Cstrong%3Ee-AWB+and+e
我必须解码并显示在Webview/UILabel中

我试过这个-,但它对我不起作用

使用这个-

- (NSString *)URLDecode:(NSString *)htmlString
{
    NSString *decodedURL = [htmlString stringByReplacingOccurrencesOfString:@"+" withString:@" "];
    decodedURL = [decodedURL stringByRemovingPercentEncoding];
    return decodedURL;
}

在这里,您得到的输出是-
e-AWB和e

您希望该字符串一旦被解码会是什么?将其作为字符串,并用相关字符替换特殊字符以生成正确的数据。@allapole我想要此形式的结果-e-AWB和e…@AkshayYerneni检查此项,尝试使用本机
NSAttributedString
带有
NSHTMLTextDocumentType
属性。很高兴为您提供帮助。嗯,您能帮我解决另外一个问题吗?如何在webview中显示此解码数据?我正在尝试相同的方法,webview中没有显示任何内容:/我正在尝试您的解决方案。嗯,它仍然没有在webview中显示任何数据。传递URL需要什么?好的。我已经试过了,还是不行:/无论如何,谢谢你在html解码方面的帮助!我会想办法显示数据。我会尽快更新答案