adopting an XML format with escaping offered by a standard library might be a solution - e.g. Python's xml.sax.saxutils
Log in to post a comment.