unicode bit me

anuraguniyal at yahoo.com anuraguniyal at yahoo.com
Sat May 9 06:44:39 CEST 2009


sorry for not being specfic and not given all info

"""
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
'Linux-2.6.24-19-generic-i686-with-debian-lenny-sid'
"""

My question has not much to do with stdout because I am able to print
unicode
so
print unicode(a) works
print unicode([a]) doesn't

without print too
s1 = u"%s"%a works
s2 = u"%s"%[a] doesn't
niether does s3 = u"%s"%unicode([a])
error is UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in
position 1: ordinal not in range(128)

so question is how can I use a list of object whose representation
contains unicode in another unicode string

I am now using __repr__ = unicode(self).encode("utf-8")
but it give error anyway



More information about the Python-list mailing list