1

I want to convert ù to ù and so on.

I tried to use the following, but it doesn't work. The original string is

E Monti nella Trilaterale non c'è più.jpg

I would like to obtain

E Monti nella Trilaterale non c'è più.jpg

but

s = [s stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

gives me

E%20Monti%20nella%20Trilaterale%20non%20c'è%20più.jpg

while

s = [s stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

leaves the original unchanged. What could I do to convert it?

Abramodj
  • 5,709
  • 9
  • 49
  • 75
  • 1
    Seems like a duplicate, please check this : http://stackoverflow.com/questions/659602/objective-c-html-escape-unescape – tomdemuyt Jan 24 '12 at 18:54
  • No I don't think it is a duplicate. – Ali Jan 24 '12 at 18:56
  • I too think it's a duplicate because you're trying to convert HTML entities into unicode representations. The method `stringByAddingPercentEscapesUsingEncoding:` converts Unicode strings into (as the name says) [percent encoded](http://en.wikipedia.org/wiki/Percent-encoding) strings (for example `` into `%20`). – DarkDust Jan 24 '12 at 19:07

1 Answers1

1

This does the job!

https://stackoverflow.com/a/2843443/396133

s = [s stringByConvertingHTMLToPlainText];
Community
  • 1
  • 1
Abramodj
  • 5,709
  • 9
  • 49
  • 75