unable to print Unicode characters in Python 3

Denis Kasak denis.kasak at gmail.com
Tue Jan 27 08:22:32 EST 2009


On Tue, Jan 27, 2009 at 1:52 PM, Giampaolo Rodola' <gnewsg at gmail.com> wrote:
> I have this same issue on Windows.
> Note that on Python 2.6 it works:
>
> Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
> (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> print unicode('\u20ac')
> \u20ac

Shouldn't this be

print unicode(u'\u20ac')

on 2.6? Without the 'u' prefix, 2.6 will just encode it as a normal
(byte) string and escape the backslash. In Python 3.0 you don't need
to do this because all strings are "unicode" to start with. I suspect
you will see the same error with 2.6 on Windows once you correct this.

(note to Giampaolo: sorry, resending this because I accidentally
selected "reply" instead of "reply to all")

-- 
Denis Kasak



More information about the Python-list mailing list