How about: import locale s=u'\u00e9' print s
locale.setlocale(locale.LC_ALL, '') locale.strxfrm( s.encode( "latin-1" ) ) --- HTH, Gerald [EMAIL PROTECTED] schrieb: > I am trying to use strxfm with unicode strings, but it does not work. > This is what I did: > > >>>>import locale >>>>s=u'\u00e9' >>>>print s > > é > >>>>locale.setlocale(locale.LC_ALL, '') > > 'French_Switzerland.1252' > >>>>locale.strxfrm(s) > > > Traceback (most recent call last): > File "<pyshell#20>", line 1, in -toplevel- > locale.strxfrm(s) > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 0: ordinal not in range(128) > > > Someone sees what I did wrong ? > -- GPG-Key: http://keyserver.veridis.com:11371/search?q=0xA140D634 -- http://mail.python.org/mailman/listinfo/python-list