Foreign characters

Dan Bishop danb_83 at yahoo.com
Wed Jul 16 01:21:47 EDT 2003


tsurusennin at softhome.net (Tetsuo) wrote in message news:<f42f0868.0307151831.7e8944b0 at posting.google.com>...
> How do I get Python to work with foreign characters? When I try to
> print them, I get a unicode error (characters not ASCII).

   # -*- coding: latin-1 -*-
   greeting = "¡Hola!  ¿Cómo estás?"
   print greeting

Or if you actually need to use Unicode strings:

   unicodeString = "a byte string".decode('encoding')
   print unicodeString.encode('encoding')




More information about the Python-list mailing list