Re: [Tutor] A unicode print question

2010-07-30 Thread Peter Otten
Joel Goldstick wrote: > I was reading this: http://diveintopython.org/xml_processing/unicode.html > > and tried the exercise: > s = u'La Pe\xf1a' [image: 1] print s [image: 2] > Traceback (innermost last): > File "", line 1, in ? > UnicodeError: ASCII encodi

Re: [Tutor] A unicode print question

2010-07-30 Thread Jerry Hill
On Fri, Jul 30, 2010 at 1:33 PM, Joel Goldstick wrote: > I was reading this: http://diveintopython.org/xml_processing/unicode.html > > and tried the exercise: > > But oddly enough, when I typed it into my python shell I did NOT get the > UnicodeError, and I wonder why not: > I believe that pyth

[Tutor] A unicode print question

2010-07-30 Thread Joel Goldstick
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 "", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>> print s.encode('latin-1') La Peña But oddl

[Tutor] A unicode print question

2010-07-30 Thread Joel Goldstick
I was reading this: http://diveintopython.org/xml_processing/unicode.html and tried the exercise: >>> s = u'La Pe\xf1a' [image: 1] >>> print s [image: 2] Traceback (innermost last): File "", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>>