How can I get Qlineedit to become unicode? pyqt

920 views Asked by At

Hi I ran into a problem when trying to process the information in a series of Qlineedits. Im living in Norway and the characters "æøå" arent accepted by my script.

This is the failing code. Retrieves the information of all my lineinputs and stores the information in a dictionary for further processing and placement in a database.

for navn in inputs:
    a = unicode(str(navn.text() ) )
    b = unicode(str(navn.objectName() ) )
    bibliotek[navn.objectName()] = a
    navn.clear()

The error I return when typing a non-ascii characters is as follows.

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in   position 0: ordinal not in range(128)

I am working in python 2.7 and I have of cource made the whole document utf-8. What do I do to solve the problem? Any answer is aprechiated.

0

There are 0 answers