unicode html
Duncan Booth
duncan.booth at invalid.invalid
Tue Jul 18 03:57:58 EDT 2006
wrote:
> As an example I would like to do this kind of conversion:
> \uc3B4 => ô
> for all available html entities.
>>> u"\u3cB4".encode('ascii','xmlcharrefreplace')
'㲴'
Don't bother using named entities. If you encode your unicode as ascii
replacing all non-ascii characters with the xml entity reference then your
pages will display fine whatever encoding is specified in the HTTP headers.
More information about the Python-list
mailing list