decoding problem uiwebview

2019-08-28 09:20发布

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条回答
Viruses.
2楼-- · 2019-08-28 09:48

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?

查看更多
登录 后发表回答