On Apr 5, 2009, at 4:35 PM, Stuart Malin wrote:

The source is not HTML tagged, but contains HTML entities.

see:
http://www.w3schools.com/tags/ref_entities.asp
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references


So, for instance, I want to convert "-->"  to "-->"

No need for an attributed string.

Thanks, but I understand the difference perfectly, but it's irrelevant. HTML entities are HTML too, so this worked fine:

NSMutableAttributedString * aStr = [[NSMutableAttributedString alloc] initWithHTML:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"file:///Users/me/test.html "]] documentAttributes:nil]; [textView replaceCharactersInRange:NSMakeRange(0, [[textView string] length]) withString:[aStr string]];

... with an HTML file containing the entity &gt (NSData from local file for convenient illustrative purposes) but your method is probably more direct / efficient. I referenced the above because you said, "I can't seem to find an NSString method to do so (not that I sometimes don't easily miss the obvious)."

  It's not strictly NSString, but might have worked fine for you.

--
I.S.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to