Python and Jython inconsistencies when encoding strings

Terry Reedy tjreedy at udel.edu
Fri Sep 6 09:00:16 EDT 2002


"Andre Michel Descombes" <amdescombes at qualicontrol.com> wrote in
message news:ala00d$dij$1 at wanadoo.fr...

> when I do the following in Python :
>
> >>> s = u'£' # Alt-0163, pound sign
> >>> print s
>
> I get the following exception, which is a normal exception:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> UnicodeError: ASCII encoding error: ordinal not in range(128)
...

On Python2.2, Windows

>>> s=u'ú' # Alt-163: u with acute accent
>>> s
u'\xa3'
>>> print s
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: ASCII encoding error: ordinal not in range(128)

What surprises me is that I thought that raw expression
(interactively) was abbreviation for print expression.  Bug here?

Terry J. Reedy






More information about the Python-list mailing list