I was reading this: http://diveintopython.org/xml_processing/unicode.html
and tried the exercise: >>> s = u'La Pe\xf1a' >>> print s Traceback (innermost last): File "<interactive input>", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>> print s.encode('latin-1') La Peña But oddly enough, when I typed it into my python shell I did NOT get the UnicodeError, and I wonder why not: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> s = u'La Pe\xf1a' >>> print s La Peña >>> import sys >>> sys.getdefaultencoding() 'ascii' > -- Joel Goldstick
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor