I have some string data in an NSData * named "data" that I have loaded from an HTML file, and I want to create an NSString with it, for easy parsing later. So I was trying to use initWithData:encoding: to create an NSString from the data:
the problem is, my data has a few chars not compatible with NSUTF8StringEncoding so the method returns "nil". How can I force it to use this encoding and ignore illegal characters? Is there a better encoding for HTML data?
NSString *string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];