Hello everyone! I'm trying to find some documentat...
# serialization
t
Hello everyone! I'm trying to find some documentation that explains how to properly convert numeric entity references in a string value while parsing XML. Can somebody point me to the proper place or tell me the magic keywords to enter into Google? 🙂 i.e. convert "&#160;" to " " (<-- non-breaking space character).
a
I didn’t know that
&#160;
was equivalent to a nbsp but apparently it can be. Maybe this answer helps trigger some keywords https://stackoverflow.com/questions/3274315/is-160-a-replacement-of-nbsp
t
My app is parsing RSS feeds, so &#160; was just one of the entities that I saw that needed to be decoded to the character. I'm not sure if it is a setting on the kotlin serialization package or what.
I also saw "&#8217;" too, which is an apostrophe.
a
Kotlinx Serialization doesn’t handle XML/HTML by default, but there is a user-supported XML library https://github.com/pdvrieze/xmlutil
but for parsing HTML you might have better luck with JSoup, or maybe Ktor