问题
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