Tracubik wrote:
Il Sun, 31 Jan 2010 13:46:16 +0100, Günther Dietrich ha
scritto:
Maybe you might solve this if you decode your string to unicode.
Example:
|>>> euro = "€"
|>>> len(euro)
|3
|>>> u_euro = euro.decode('utf_8')
|>>> len(u_euro)
|1
Adapt the encoding ('utf_8' in my example) to whatever you use.
Or create the unicode string directly:
|>>> u_euro = u'€'
|>>> len(u_euro)
|1
Best regards,
Günther
thank you, your two solution is really interesting.
is there a possible to set unicode encoding by default for my python
scripts?
i've tried inserting
# -*- coding: utf-8 -*-
at the beginning of my script but doesn't solve the problem
That tells Python which encoding the file is using, but you still need
to save the file in that encoding.
--
http://mail.python.org/mailman/listinfo/python-list