[SOLVED] Least-lossy string.encode to us-ascii?

Tim Chase python.list at tim.thechases.com
Thu Sep 13 18:06:25 EDT 2012


On 09/13/12 16:44, Vlastimil Brom wrote:
> >>> import unicodedata
> >>> unicodedata.normalize("NFD", u"serviço móvil").encode("ascii", "ignore").decode("ascii")
> u'servico movil'

Works well for all the test-cases I threw at it.  Thanks!

-tkc





More information about the Python-list mailing list