I do not managed to simply print a QString variable containing a special character.
I always get a UnicodeEncodeError:
'ascii' codec can't encode characters in position ....
Here is the code I tried without success :
var1 = "éé" #idem with u"éé"
var2 = QString (var1)
print var2
--->>> UnicodeEncodeError
print str(var2)
--->>> UnicodeEncoreError
var3 = QString.fromLocal8Bit (var1) #idem with fromLatin1 and fromUtf8
print var3
--->>> UnicodeEncodeError
codec = QTextCodec.codecForName ("UTF-8") #idem with ISO 8859-1
var4 = codec.toUnicode (var2.toUtf8().data()) #idem with toLatin1 instead of toUtf8
print var4
--->>> UnicodeEncodeError
I also tried to use :
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"))
I really need to print a QString variable, not a QByteArray or other object.