Message 89684 - Python tracker (original) (raw)
That's backwards, unless I'm missing something here: charrefs represent Unicode characters, not UTF-8 byte values. The character "LATIN SMALL LETTER A WITH TILDE" with the character value 227 should be represented as "ã" if serialized to an encoding that doesn't support non-ASCII characters.
And there's no need to use RE:s to filter things under 3.X; those parts of ET 1.2 are there for pre-2.0 compatibility.
Did you try running the tests with the escape function I posted?