Ярлыки

суббота, 3 ноября 2012 г.

problem with encoding in PyQt4


Python2.7, Eric4, PyQt4 
I have follow problem:
when I send list to form for fill ComboBox: in ComboBox I see abracadabra. My coding is utf-8.

My code:
sectList=[i[0] for i in sectionsDict.items()]
print(sectList)
main_window.selectSection.addItems(sectList)

Function "print" insert for see what doing here.

Solve of the problem:
sectList=[unicode(i[0], 'cp1251') for i in sectionsDict.items()]
print(sectList)
main_window.selectSection.addItems(sectList)

Комментариев нет:

Отправить комментарий