I need to replace all the ascii symbols other than alphabets into HTML number (http://www.ascii.cl/htmlcodes.htm).
From this post(Convert HTML entities to Unicode and vice versa), I could use this code, but I still can't get *
(or maybe many other characters) working.
What could be the solution? Just simple replacements could be the only solution?
>>> from BeautifulSoup import BeautifulStoneSoup as bs
>>> import cgi
>>> cgi.escape("<*>").encode('ascii', 'xmlcharrefreplace')
'<*>'