Substitution for the deprecated method stringByReplacingPercentEscapesUsingEncoding for NSString

We need to parse emails in our app, that are sometimes encoded in NSISOLatin1StringEncoding instead of NSUTF8StringEncoding. Unfortunately the convenient method stringByReplacingPercentEscapesUsingEncoding for NSString objects is deprecated. The recommended method stringByRemovingPercentEncoding is not sufficient for our use case.

How to transform NSString objects with iso-8859-1 encoding?
There isn’t a direct replacement for this because the method as a whole doesn’t really make a lot of sense. If you find it useful in your app I’d be inclined to just keep on using it. If it ever goes away then you’ll have to reimplement it yourself, but that’s not super hard.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Substitution for the deprecated method stringByReplacingPercentEscapesUsingEncoding for NSString
 
 
Q