解码问题uiwebview [英] decoding problem uiwebview

查看:237
本文介绍了解码问题uiwebview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用uiwebview。当用户单击http搜索开始时,会有一些链接。它工作正常,但在获取%58 den ysnky’ye tepki时遇到问题,它的名称为 X’den ysnky’ye tepki。

i am using uiwebview in my application. there are some links when user clicks a http search starts. it works fine but i have problems while getting "%58 den ysnky'ye tepki" it is given as "X'den ysnky'ye tepki". it has problems with % char.

标识符:%58'den%20ysnky'ye%20tepki

identifier:%58'den%20ysnky'ye%20tepki

已解码标识符:X'den ysnky'ye tepki

decoded identifier:X'den ysnky'ye tepki

我正在使用stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding对这样的字符串进行解码;

i am using stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding to decode the string like that;

NSLog(@ identifier:%@,标识符);
标识符= [标识符stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@ decoded identifier:%@,identifier);

NSLog(@"identifier:%@", identifier); identifier = [identifier stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSLog(@"decoded identifier:%@", identifier);

我如何获得正确的字符串?
谢谢...

how can i get the correct string? thanks...

推荐答案

看起来您的字符串最初可能没有正确编码。 %58是字母 X的正确编码(请参阅此 ASCII表)。据我所知,解码工作正常。

It looks like your string may not be encoded properly in the first place. %58 is the correct encoding for the letter "X" (see this ASCII table). As far as I can tell, therefore, the decode is behaving properly.

您期望什么?

这篇关于解码问题uiwebview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆