Some characters, such as ordinal 22 or 8, don't display in html (using chrome, for example when copy-and-pasting them into this 'Ask question' editor; I am assuming utf-8). How do I determine which characters are valid html, and of the valid, which are rendered?
A table/reference would be helpful (I couldn't find one by google-ing), but preferably I need a set of rules or a solution that can be implemented in python.
What is a valid character in HTML depends on your definition for “HTML” and “valid”. Different HTML versions have different rules for formally valid characters, and they may have characters that are valid but not recommended. Moreover, there are general policies such as favoring Normalization Form C; though not part of HTML specifications, such policies are often regarded as relevant to HTML, too.
What is rendered (and how) depends on the browser, the style sheets of the HTML document, and available fonts in the user’s computer. Moreover, not all characters are rendered as such. For example, in normal HTML content, any contiguous sequence of whitespace characters is treated as equivalent to a single space character.
So the answer is really “It depends.” Consider asking a much more targeted practical question to get a more targeted answer.
How to I determine whether a character is valid-for/rendered-in html?