unicode experiments + questions -- PythonWin??

Irmen de Jong irmen at NOSPAMREMOVETHISxs4all.nl
Wed Mar 27 18:39:30 EST 2002


Brian Quinlan wrote:
> >>> e=u'\u20ac'
> >>> e
> u'\u20ac'
> >>> print e
> €    (<--- this is an Euro symbol on my screen)

>Is this what actually happens? Did you change your default encoding to
>be something other than ASCII, possible by modifying site.py?

I changed it back to the default, "ascii".
The example is from within PythonWin (the GUI!).
There is something with that: when I do "print e" in PythonWin it prints the
Euro, €.
When I do "print e" in the console python, it throws an exception
ASCII encoding error: ordinal not in range(128)
Print redirection to a file using print >> also throws the encoding exception in
PythonWin.
Only directly printing to the GUI console appears to work.
Hmmm... What does PythonWin do!??


> The print does not do any conversion; it just sends bytes to the output
stream.
Hmm... how does it send the unicode string to the output stream?
Not as raw unicode (unconverted), because print redirection throws an encoding
exception.

Irmen






More information about the Python-list mailing list