Question

My program stores file index in file packed by cPickle. There are non-english filenames. When I just do this

print f [0]

where f [0] is "\xc2\xe8\xf1\xee\xea\xee\xf1\xed\xfb\xe9 \xe3\xee\xe4" ("Високосный год" in normal view), it prints the string in proper way — in russian.

When the program manually adds the string u'Високосный год' to QTreeView, everything is fine.

But when the program puts this string ("\xe3\xee\xe4" etc.) straight from unpickled file to QTreeView, it becomes like that:

alt text http://img170.imageshack.us/img170/9226/encoding.png

Is there any way to solve that?

Was it helpful?

Solution

Have you run decode on the unpickled string using the correct encoding ("cp1251" by the look of it)? If not, you need to do this to make sure you're passing a Unicode string to the GUI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top