Risposta al messaggio di Chris Angelico :
Your __str__ method is not returning a string. It's returning a
Unicode object. Under Python 2 (which you're obviously using, since
you use print as a statement), strings are bytes. The best thing to do
would be to move to Python 3.3, in which the defaul
On Sat, Dec 8, 2012 at 1:14 AM, gialloporpora wrote:
print a
> UnicodeError
print a.__str__()
> OK
By the way, it's *much* more helpful to copy and paste the actual
error message and output, rather than retyping like that. Spending one
extra minute in the interactive interpreter before
On 12/07/2012 11:17 AM, gialloporpora wrote:
Risposta al messaggio di gialloporpora :
This is the code in my test.py:
Sorry, I have wrongly pasted the code:
class msgmarker(object):
def __init__(self, msgid, msgstr, index, encoding="utf-8"):
self._encoding =encoding
self
On Sat, Dec 8, 2012 at 1:14 AM, gialloporpora wrote:
> Dear all,
> I have a problem with character encoding.
> I have created my class and I have redefined the __str__ method for pretty
> printing. I have saved my file as test.py,
> I give these lines:
>
from test import *
a = msgmarker
Risposta al messaggio di gialloporpora :
This is the code in my test.py:
Sorry, I have wrongly pasted the code:
class msgmarker(object):
def __init__(self, msgid, msgstr, index, encoding="utf-8"):
self._encoding =encoding
self.set(msgid, msgstr)