InDesign can export an XML file, and it will also “Remap break, whitespace, and special characters” if you check the box to do that. How can I do the same thing on text?
For example, if I have: •this is a bullet —long dash
InDesign exports as: &# 8226;this is a bullet &# 8212;long dash
I don’t know what kind of encoding this is. Can a standard Objective-C class do this (working on OS X) or a third party library?
They are an HTML thing. People usually refer to as HTML encoding but technically, they are Numeric character references. There is nothing built into Foundation that decodes them, but if you look around you can find some code to handle it (for example, https://github.com/mwaterfall/MWFeedParser/blob/master/Classes/NSString+HTML.m).