Possible Unicode Bug in Pythonwin on version 2.2.2 ?

Chris Lyon chris.lyon at spritenote.co.uk
Thu Feb 13 11:17:16 CET 2003

"vincent wehren" <v.wehren at home.nl> wrote in message news:<b2e5mf$poc$1 at news1.tilbu1.nb.home.nl>...
> "Chris Lyon" <chris.lyon at spritenote.co.uk> schrieb im Newsbeitrag
> news:d232c5e.0302121048.5033368c at posting.google.com...
> > In the interactive window type:-
> > s=u'La Pe\xf1a Colada'
> >
> > print s
> >
> > removes the last 'a' on Colada,
> Actually, I would expect an UnicodeError
> >>> print s.encode("cp1252")
>  La Peña Colada
> Regards
> Vincent
> Sorry I didn't fully explain I have 


set as follows

# sitecustomize.py                   
# this file can be anywhere in your Python path,
# but it usually goes in ${pythondir}/lib/site-packages/

import sys


So I am able to print in this fashion.. :)

So to re-iterate.

PythonWin 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on
Portions Copyright 1994-2001 Mark Hammond (mhammond at skippinet.com.au)
- see 'Help/About PythonWin' for further copyright information.
>>> s = u'La Pe\xf1a'
>>> print s.encode('latin-1')
La Peña
>>> s = u'La Pe\xf1a Colada'
>>> print s.encode('latin-1')
La Peña Colad
>>> len(s)
>>> s[:-1]
u'La Pe\xf1a Colad'
>>> s[-1:]

The trailing 'a' character is not shown as above however when cut and
paste from the pythonwin interactive window it into the above section
it does appear!.
It's a small point but It's the sort of thing that can have you
running round the houses for many a long while if you are trying to
get your head round a bit of interactive debugging.

For students of Spanish and Alcoholic Beverages, please note I don't
know if this is indeed how this particular liquid distraction is spelt
its just a little bit better that the 'fred' I originally tested with
which demonstrated the same effect turning into 'La Pe\xf1ana Fre'.

More information about the Python-list mailing list