unicode html

Gerard Flanagan grflanagan at yahoo.co.uk
Mon Jul 17 11:07:36 EDT 2006


lorenzo.viscanti at gmail.com wrote:
> X-No-Archive: yes
> Hi, I've found lots of material on the net about unicode html
> conversions, but still i'm having many problems converting unicode
> characters to html entities. Is there any available function to solve
> this issue?
> As an example I would like to do this kind of conversion:
> \uc3B4 => ô
> for all available html entities.
>
> thanks,
> lorenzo

no expertise with unicode issues but using 'pytextile' at the minute
which converts non-ascii to (numeric) html entities. It does something
like:

>>> s =unicode('\xe7', encoding='latin-1')
>>> s
u'\xe7'
>>> print s
ç
>>> print s.encode('ascii','xmlcharrefreplace')
ç


    http://wiki.python.org/moin/PyTextile


hth

Gerard




More information about the Python-list mailing list