decoding problem uiwebview

扶醉桌前 提交于 2019-12-12 01:16:13

问题


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.

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

decoded identifier:X'den ysnky'ye tepki

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

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

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


回答1:


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.

What are you expecting?



来源:https://stackoverflow.com/questions/4338123/decoding-problem-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!