Re: [PyQt] including Unicode in QListWidget

2012-06-20 Thread David Beck
Thank you, the new snapshot works fine, problem solved.

cheers

David

On 2012-06-19, at 10:40 AM, Phil Thompson wrote:

 On Tue, 19 Jun 2012 10:32:07 -0600, David Beck db...@ualberta.ca wrote:
 Hi, Phil
 
 Thanks for your suggestion. I tried the workaround at the bottom, but it
 didn't seem to have any effect. However, my installation seems not to
 match
 the path you gave (I don't seem to have a /path/to/qt/ directory at all
 that I can find).
 
 That wasn't meant to be taken literally - replace it with the actual path
 to your Qt installation.
 
 I installed PyQt from
 PyQt-mac-gpl-snapshot-4.9.2-d49ae8bd9152.tar. It created a directory
 right
 next to itself called PyQt and the mkspecs folder is inside that. I
 went
 there, entered the ln command, ran python3.3 configure.py ..., make and
 make install, but I'm still having the same issue when I run the GUI.
 
 If tonight's snapshot might be a fix, I'll try to install that—would
 that
 just be a matter of replacing the existing PyQt folder and going through
 the configure  make  make install routine? (Sorry for all the dumb
 questions—I'm willing to admit I'm way in over my head here.)
 
 Just build it in exactly the same way as you did before.
 
 Phil
 

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] including Unicode in QListWidget

2012-06-19 Thread Phil Thompson
On Sun, 17 Jun 2012 10:29:58 -0600, David Beck db...@ualberta.ca wrote:
 I am trying to build a GUI for navigating through a large XML database
on
 a Mac running OS 10.7, Python 3.3, PyQt 4. I want to get a list of the
text
 in all of the nodes called Orth and put them into a QListWidget called
 hLexNav. To do this, I wrote the following bit of code (this isn't the
 whole thing, just the parts that are supposed to add items to the
listbox):
 
 
 import sys
 from PyQt4 import QtCore, QtGui
 from xml.dom import minidom
 import xml.etree.ElementTree as etree
 from fieldbookGui import Ui_Fieldbook
 import images
 import btnCmds
  
 class MyForm(QtGui.QMainWindow):
   def __init__(self, parent=None):
 QtGui.QWidget.__init__(self, parent)
 self.ui = Ui_Fieldbook()
 self.ui.setupUi(self)
 
 
 xmltree = etree.parse('BabyDb.xml')
 root = xmltree.getroot()
 for child in root:
   self.ui.hLexNav.addItem(child.findtext('Orth'))
 
 The first 25 items that are returned by child.findtext('Orth') are:
 
 ['a:', 'a:cháj', 'a:chulá:', a:hé:xtu', 'a:ho:tán', 'a:kús',
 a:li:ma'htín, 'a:li:stá:n', 'a:má', a:ma'ha:'pi'tzí'n,
'a:mixtzayán',
 'a:nanú:', 'a:tú:n', 'a:tzá:', a:tzemá'j, 'a:xí:lh', 'a:xtúm',
'a:xú:x',
 a:'hála', a:'j, a:'jmá, a:'jnanú:, a:'jtzá:, a:'jtzananú:,
 a:'kní:]
 
 In the QListWidget created by this code, I see only items corresponding
to
 those elements that do not contain accented vowels (here, those that
don't
 contain á, ú, etc.); items that correpsond to strings with accented
 vowels are left empty. Further experimentation with addItem( ),
addItems(),
 and insertItem( ) show that any string that contains an non-ASCII
character
 results in an empty Item being inserted into the QListWidget.
 
 Any ideas about what is going on would be appreciated.

It's a compiler bug, see...

http://bugs.python.org/issue13241

Tonight's snapshot will disable the PEP 393 support if LLVM is being used.
Another workaround is to enable Qt4's clang support...

cd /path/to/qt/mkspecs
ln -s unsupported/macx-clang macx-clang

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] including Unicode in QListWidget

2012-06-19 Thread Phil Thompson
On Tue, 19 Jun 2012 10:32:07 -0600, David Beck db...@ualberta.ca wrote:
 Hi, Phil
 
 Thanks for your suggestion. I tried the workaround at the bottom, but it
 didn't seem to have any effect. However, my installation seems not to
match
 the path you gave (I don't seem to have a /path/to/qt/ directory at all
 that I can find).

That wasn't meant to be taken literally - replace it with the actual path
to your Qt installation.

 I installed PyQt from
 PyQt-mac-gpl-snapshot-4.9.2-d49ae8bd9152.tar. It created a directory
right
 next to itself called PyQt and the mkspecs folder is inside that. I
went
 there, entered the ln command, ran python3.3 configure.py ..., make and
 make install, but I'm still having the same issue when I run the GUI.
 
 If tonight's snapshot might be a fix, I'll try to install that—would
that
 just be a matter of replacing the existing PyQt folder and going through
 the configure  make  make install routine? (Sorry for all the dumb
 questions—I'm willing to admit I'm way in over my head here.)

Just build it in exactly the same way as you did before.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] including Unicode in QListWidget

2012-06-18 Thread David Beck
 
 Message: 1
 Date: Mon, 18 Jun 2012 05:03:28 +0200
 From: Knacktus knack...@googlemail.com
 To: pyqt@riverbankcomputing.com
 Subject: Re: [PyQt] including Unicode in QListWidget
 Message-ID: 4fde9a80.50...@googlemail.com
 Content-Type: text/plain; charset=UTF-8; format=flowed
 
 Am 17.06.2012 22:55, schrieb David Beck:
 Message: 2
 Date: Sun, 17 Jun 2012 18:42:54 +0200
 From: Knacktus knack...@googlemail.com mailto:knack...@googlemail.com
 To: pyqt@riverbankcomputing.com mailto:pyqt@riverbankcomputing.com
 Subject: Re: [PyQt] including Unicode in QListWidget
 Message-ID: 4fde090e.1070...@googlemail.com
 mailto:4fde090e.1070...@googlemail.com
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 Am 17.06.2012 18:29, schrieb David Beck:
 I am trying to build a GUI for navigating through a large XML
 database on a Mac running OS 10.7, Python 3.3, PyQt 4. I want to get
 a list of the text in all of the nodes calledOrth and put them into
 a QListWidget called hLexNav. To do this, I wrote the following bit
 of code (this isn't the whole thing, just the parts that are supposed
 to add items to the listbox):
 
 
 import sys
 from PyQt4 import QtCore, QtGui
 from xml.dom import minidom
 import xml.etree.ElementTree as etree
 from fieldbookGui import Ui_Fieldbook
 import images
 import btnCmds
 
 class MyForm(QtGui.QMainWindow):
 def __init__(self, parent=None):
 QtGui.QWidget.__init__(self, parent)
 self.ui = Ui_Fieldbook()
 self.ui.setupUi(self)
 
 
 xmltree = etree.parse('BabyDb.xml')
 root = xmltree.getroot()
 for child in root:
 self.ui.hLexNav.addItem(child.findtext('Orth'))
 
 The first 25 items that are returned by child.findtext('Orth') are:
 
 ['a:', 'a:ch?j', 'a:chul?:', a:h?:xtu', 'a:ho:t?n', 'a:k?s',
 a:li:ma'ht?n, 'a:li:st?:n', 'a:m?', a:ma'ha:'pi'tz?'n,
 'a:mixtzay?n', 'a:nan?:', 'a:t?:n', 'a:tz?:', a:tzem?'j, 'a:x?:lh',
 'a:xt?m', 'a:x?:x', a:'h?la', a:'j, a:'jm?, a:'jnan?:,
 a:'jtz?:, a:'jtzanan?:, a:'kn?:]
 
 In the QListWidget created by this code, I see only items
 corresponding to those elements that do not contain accented vowels
 (here, those that don't contain ?, ?, etc.); items that
 correpsond to strings with accented vowels are left empty. Further
 experimentation with addItem( ), addItems(), and insertItem( ) show
 that any string that contains an non-ASCII character results in an
 empty Item being inserted into the QListWidget.
 
 Any ideas about what is going on would be appreciated.
 
 Are you 100 % sure that unicode is handled properly while reading the
 xml? I never had problems with unicode and PyQt but I strictly using
 unicode strings only in my apps.
 
 This for example works for me (Python 2.7):
 
 # -*- coding: utf-8 -*-
 
 if __name__ == __main__:
 
 import sys
 from PyQt4.QtGui import *
 app = QApplication(sys.argv)
 list_widget = QListWidget()
 list_widget.addItem(u??^? l? l?)
 list_widget.show()
 app.exec_()
 
 
 Yes, it seems to be independent of the XML. For instance, I get the same
 thing when I run the little app below (the GUI is generated by pyuic4):
 
import sys
from PyQt4 import QtCore, QtGui
 
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
 
class Ui_UTFWidget(object):
def setupUi(self, UTFWidget):
UTFWidget.setObjectName(_fromUtf8(UTFWidget))
UTFWidget.resize(400, 300)
self.centralWidget = QtGui.QWidget(UTFWidget)
self.centralWidget.setObjectName(_fromUtf8(centralWidget))
self.listWidget = QtGui.QListWidget(self.centralWidget)
self.listWidget.setGeometry(QtCore.QRect(17, 9, 362, 241))
self.listWidget.setObjectName(_fromUtf8(listWidget))
UTFWidget.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(UTFWidget)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 22))
self.menuBar.setObjectName(_fromUtf8(menuBar))
self.menuUTF_test = QtGui.QMenu(self.menuBar)
self.menuUTF_test.setObjectName(_fromUtf8(menuUTF_test))
UTFWidget.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(UTFWidget)
self.mainToolBar.setObjectName(_fromUtf8(mainToolBar))
UTFWidget.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(UTFWidget)
self.statusBar.setObjectName(_fromUtf8(statusBar))
UTFWidget.setStatusBar(self.statusBar)
self.menuBar.addAction(self.menuUTF_test.menuAction())
 
self.retranslateUi(UTFWidget)
QtCore.QMetaObject.connectSlotsByName(UTFWidget)
 
def retranslateUi(self, UTFWidget):
UTFWidget.setWindowTitle(QtGui.QApplication.translate(UTFWidget,
UTFWidget, None, QtGui.QApplication.UnicodeUTF8))
self.menuUTF_test.setTitle(QtGui.QApplication.translate(UTFWidget,
UTF test, None, QtGui.QApplication.UnicodeUTF8))
 
class MyForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_UTFWidget()
self.ui.setupUi(self)
 
self.ui.listWidget.addItem(abcde

[PyQt] including Unicode in QListWidget

2012-06-17 Thread David Beck
I am trying to build a GUI for navigating through a large XML database on a Mac 
running OS 10.7, Python 3.3, PyQt 4. I want to get a list of the text in all of 
the nodes called Orth and put them into a QListWidget called hLexNav. To do 
this, I wrote the following bit of code (this isn't the whole thing, just the 
parts that are supposed to add items to the listbox):


import sys
from PyQt4 import QtCore, QtGui
from xml.dom import minidom
import xml.etree.ElementTree as etree
from fieldbookGui import Ui_Fieldbook
import images
import btnCmds
 
class MyForm(QtGui.QMainWindow):
  def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Fieldbook()
self.ui.setupUi(self)


xmltree = etree.parse('BabyDb.xml')
root = xmltree.getroot()
for child in root:
  self.ui.hLexNav.addItem(child.findtext('Orth'))

The first 25 items that are returned by child.findtext('Orth') are:

['a:', 'a:cháj', 'a:chulá:', a:hé:xtu', 'a:ho:tán', 'a:kús', a:li:ma'htín, 
'a:li:stá:n', 'a:má', a:ma'ha:'pi'tzí'n, 'a:mixtzayán', 'a:nanú:', 'a:tú:n', 
'a:tzá:', a:tzemá'j, 'a:xí:lh', 'a:xtúm', 'a:xú:x', a:'hála', a:'j, 
a:'jmá, a:'jnanú:, a:'jtzá:, a:'jtzananú:, a:'kní:]

In the QListWidget created by this code, I see only items corresponding to 
those elements that do not contain accented vowels (here, those that don't 
contain á, ú, etc.); items that correpsond to strings with accented vowels 
are left empty. Further experimentation with addItem( ), addItems(), and 
insertItem( ) show that any string that contains an non-ASCII character results 
in an empty Item being inserted into the QListWidget.

Any ideas about what is going on would be appreciated.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] including Unicode in QListWidget

2012-06-17 Thread Knacktus

Am 17.06.2012 18:29, schrieb David Beck:

I am trying to build a GUI for navigating through a large XML database on a Mac running OS 
10.7, Python 3.3, PyQt 4. I want to get a list of the text in all of the nodes 
calledOrth  and put them into a QListWidget called hLexNav. To do this, I 
wrote the following bit of code (this isn't the whole thing, just the parts that are supposed 
to add items to the listbox):


import sys
from PyQt4 import QtCore, QtGui
from xml.dom import minidom
import xml.etree.ElementTree as etree
from fieldbookGui import Ui_Fieldbook
import images
import btnCmds

class MyForm(QtGui.QMainWindow):
   def __init__(self, parent=None):
 QtGui.QWidget.__init__(self, parent)
 self.ui = Ui_Fieldbook()
 self.ui.setupUi(self)


 xmltree = etree.parse('BabyDb.xml')
 root = xmltree.getroot()
 for child in root:
   self.ui.hLexNav.addItem(child.findtext('Orth'))

The first 25 items that are returned by child.findtext('Orth') are:

['a:', 'a:cháj', 'a:chulá:', a:hé:xtu', 'a:ho:tán', 'a:kús', a:li:ma'htín, 'a:li:stá:n', 'a:má', a:ma'ha:'pi'tzí'n, 'a:mixtzayán', 'a:nanú:', 'a:tú:n', 
'a:tzá:', a:tzemá'j, 'a:xí:lh', 'a:xtúm', 'a:xú:x', a:'hála', a:'j, a:'jmá, a:'jnanú:, a:'jtzá:, 
a:'jtzananú:, a:'kní:]

In the QListWidget created by this code, I see only items corresponding to those elements that do 
not contain accented vowels (here, those that don't contain á, ú, etc.); 
items that correpsond to strings with accented vowels are left empty. Further experimentation with 
addItem( ), addItems(), and insertItem( ) show that any string that contains an non-ASCII character 
results in an empty Item being inserted into the QListWidget.

Any ideas about what is going on would be appreciated.


Are you 100 % sure that unicode is handled properly while reading the 
xml? I never had problems with unicode and PyQt but I strictly using 
unicode strings only in my apps.


This for example works for me (Python 2.7):

# -*- coding: utf-8 -*-

if __name__ == __main__:

import sys
from PyQt4.QtGui import *
app = QApplication(sys.argv)
list_widget = QListWidget()
list_widget.addItem(uÄÜ^°  là lÁ)
list_widget.show()
app.exec_()




___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] including Unicode in QListWidget

2012-06-17 Thread David Beck
 Message: 2
 Date: Sun, 17 Jun 2012 18:42:54 +0200
 From: Knacktus knack...@googlemail.com
 To: pyqt@riverbankcomputing.com
 Subject: Re: [PyQt] including Unicode in QListWidget
 Message-ID: 4fde090e.1070...@googlemail.com
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 Am 17.06.2012 18:29, schrieb David Beck:
 I am trying to build a GUI for navigating through a large XML database on a 
 Mac running OS 10.7, Python 3.3, PyQt 4. I want to get a list of the text in 
 all of the nodes calledOrth  and put them into a QListWidget called 
 hLexNav. To do this, I wrote the following bit of code (this isn't the 
 whole thing, just the parts that are supposed to add items to the listbox):
 
 
 import sys
 from PyQt4 import QtCore, QtGui
 from xml.dom import minidom
 import xml.etree.ElementTree as etree
 from fieldbookGui import Ui_Fieldbook
 import images
 import btnCmds
 
 class MyForm(QtGui.QMainWindow):
   def __init__(self, parent=None):
 QtGui.QWidget.__init__(self, parent)
 self.ui = Ui_Fieldbook()
 self.ui.setupUi(self)
 
 
 xmltree = etree.parse('BabyDb.xml')
 root = xmltree.getroot()
 for child in root:
   self.ui.hLexNav.addItem(child.findtext('Orth'))
 
 The first 25 items that are returned by child.findtext('Orth') are:
 
 ['a:', 'a:ch?j', 'a:chul?:', a:h?:xtu', 'a:ho:t?n', 'a:k?s', 
 a:li:ma'ht?n, 'a:li:st?:n', 'a:m?', a:ma'ha:'pi'tz?'n, 'a:mixtzay?n', 
 'a:nan?:', 'a:t?:n', 'a:tz?:', a:tzem?'j, 'a:x?:lh', 'a:xt?m', 'a:x?:x', 
 a:'h?la', a:'j, a:'jm?, a:'jnan?:, a:'jtz?:, a:'jtzanan?:, 
 a:'kn?:]
 
 In the QListWidget created by this code, I see only items corresponding to 
 those elements that do not contain accented vowels (here, those that don't 
 contain ?, ?, etc.); items that correpsond to strings with accented 
 vowels are left empty. Further experimentation with addItem( ), addItems(), 
 and insertItem( ) show that any string that contains an non-ASCII character 
 results in an empty Item being inserted into the QListWidget.
 
 Any ideas about what is going on would be appreciated.
 
 Are you 100 % sure that unicode is handled properly while reading the 
 xml? I never had problems with unicode and PyQt but I strictly using 
 unicode strings only in my apps.
 
 This for example works for me (Python 2.7):
 
 # -*- coding: utf-8 -*-
 
 if __name__ == __main__:
 
 import sys
 from PyQt4.QtGui import *
 app = QApplication(sys.argv)
 list_widget = QListWidget()
 list_widget.addItem(u??^?  l? l?)
 list_widget.show()
 app.exec_()
 

Yes, it seems to be independent of the XML. For instance, I get the same thing 
when I run the little app below (the GUI is generated by pyuic4): 

import sys
from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s

class Ui_UTFWidget(object):
def setupUi(self, UTFWidget):
UTFWidget.setObjectName(_fromUtf8(UTFWidget))
UTFWidget.resize(400, 300)
self.centralWidget = QtGui.QWidget(UTFWidget)
self.centralWidget.setObjectName(_fromUtf8(centralWidget))
self.listWidget = QtGui.QListWidget(self.centralWidget)
self.listWidget.setGeometry(QtCore.QRect(17, 9, 362, 241))
self.listWidget.setObjectName(_fromUtf8(listWidget))
UTFWidget.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(UTFWidget)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 22))
self.menuBar.setObjectName(_fromUtf8(menuBar))
self.menuUTF_test = QtGui.QMenu(self.menuBar)
self.menuUTF_test.setObjectName(_fromUtf8(menuUTF_test))
UTFWidget.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(UTFWidget)
self.mainToolBar.setObjectName(_fromUtf8(mainToolBar))
UTFWidget.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(UTFWidget)
self.statusBar.setObjectName(_fromUtf8(statusBar))
UTFWidget.setStatusBar(self.statusBar)
self.menuBar.addAction(self.menuUTF_test.menuAction())

self.retranslateUi(UTFWidget)
QtCore.QMetaObject.connectSlotsByName(UTFWidget)

def retranslateUi(self, UTFWidget):
UTFWidget.setWindowTitle(QtGui.QApplication.translate(UTFWidget, 
UTFWidget, None, QtGui.QApplication.UnicodeUTF8))
self.menuUTF_test.setTitle(QtGui.QApplication.translate(UTFWidget, 
UTF test, None, QtGui.QApplication.UnicodeUTF8))

class MyForm(QtGui.QMainWindow):
  def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_UTFWidget()
self.ui.setupUi(self)

self.ui.listWidget.addItem(abcde)
self.ui.listWidget.addItem(áɬʔéí)

if __name__ == __main__:
  app = QtGui.QApplication(sys.argv)
  myapp = MyForm()
  myapp.show()
  sys.exit(app.exec_())

notice that there are two additem() methods, one which adds straight ASCII, the 
other which adds some non-ASCII characters. When I run the app

Re: [PyQt] including Unicode in QListWidget

2012-06-17 Thread Knacktus

Am 17.06.2012 22:55, schrieb David Beck:

Message: 2
Date: Sun, 17 Jun 2012 18:42:54 +0200
From: Knacktus knack...@googlemail.com mailto:knack...@googlemail.com
To: pyqt@riverbankcomputing.com mailto:pyqt@riverbankcomputing.com
Subject: Re: [PyQt] including Unicode in QListWidget
Message-ID: 4fde090e.1070...@googlemail.com
mailto:4fde090e.1070...@googlemail.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Am 17.06.2012 18:29, schrieb David Beck:

I am trying to build a GUI for navigating through a large XML
database on a Mac running OS 10.7, Python 3.3, PyQt 4. I want to get
a list of the text in all of the nodes calledOrth and put them into
a QListWidget called hLexNav. To do this, I wrote the following bit
of code (this isn't the whole thing, just the parts that are supposed
to add items to the listbox):


import sys
from PyQt4 import QtCore, QtGui
from xml.dom import minidom
import xml.etree.ElementTree as etree
from fieldbookGui import Ui_Fieldbook
import images
import btnCmds

class MyForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Fieldbook()
self.ui.setupUi(self)


xmltree = etree.parse('BabyDb.xml')
root = xmltree.getroot()
for child in root:
self.ui.hLexNav.addItem(child.findtext('Orth'))

The first 25 items that are returned by child.findtext('Orth') are:

['a:', 'a:ch?j', 'a:chul?:', a:h?:xtu', 'a:ho:t?n', 'a:k?s',
a:li:ma'ht?n, 'a:li:st?:n', 'a:m?', a:ma'ha:'pi'tz?'n,
'a:mixtzay?n', 'a:nan?:', 'a:t?:n', 'a:tz?:', a:tzem?'j, 'a:x?:lh',
'a:xt?m', 'a:x?:x', a:'h?la', a:'j, a:'jm?, a:'jnan?:,
a:'jtz?:, a:'jtzanan?:, a:'kn?:]

In the QListWidget created by this code, I see only items
corresponding to those elements that do not contain accented vowels
(here, those that don't contain ?, ?, etc.); items that
correpsond to strings with accented vowels are left empty. Further
experimentation with addItem( ), addItems(), and insertItem( ) show
that any string that contains an non-ASCII character results in an
empty Item being inserted into the QListWidget.

Any ideas about what is going on would be appreciated.


Are you 100 % sure that unicode is handled properly while reading the
xml? I never had problems with unicode and PyQt but I strictly using
unicode strings only in my apps.

This for example works for me (Python 2.7):

# -*- coding: utf-8 -*-

if __name__ == __main__:

import sys
from PyQt4.QtGui import *
app = QApplication(sys.argv)
list_widget = QListWidget()
list_widget.addItem(u??^? l? l?)
list_widget.show()
app.exec_()



Yes, it seems to be independent of the XML. For instance, I get the same
thing when I run the little app below (the GUI is generated by pyuic4):

import sys
from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s

class Ui_UTFWidget(object):
def setupUi(self, UTFWidget):
UTFWidget.setObjectName(_fromUtf8(UTFWidget))
UTFWidget.resize(400, 300)
self.centralWidget = QtGui.QWidget(UTFWidget)
self.centralWidget.setObjectName(_fromUtf8(centralWidget))
self.listWidget = QtGui.QListWidget(self.centralWidget)
self.listWidget.setGeometry(QtCore.QRect(17, 9, 362, 241))
self.listWidget.setObjectName(_fromUtf8(listWidget))
UTFWidget.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(UTFWidget)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 22))
self.menuBar.setObjectName(_fromUtf8(menuBar))
self.menuUTF_test = QtGui.QMenu(self.menuBar)
self.menuUTF_test.setObjectName(_fromUtf8(menuUTF_test))
UTFWidget.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(UTFWidget)
self.mainToolBar.setObjectName(_fromUtf8(mainToolBar))
UTFWidget.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(UTFWidget)
self.statusBar.setObjectName(_fromUtf8(statusBar))
UTFWidget.setStatusBar(self.statusBar)
self.menuBar.addAction(self.menuUTF_test.menuAction())

self.retranslateUi(UTFWidget)
QtCore.QMetaObject.connectSlotsByName(UTFWidget)

def retranslateUi(self, UTFWidget):
UTFWidget.setWindowTitle(QtGui.QApplication.translate(UTFWidget,
UTFWidget, None, QtGui.QApplication.UnicodeUTF8))
self.menuUTF_test.setTitle(QtGui.QApplication.translate(UTFWidget,
UTF test, None, QtGui.QApplication.UnicodeUTF8))

class MyForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_UTFWidget()
self.ui.setupUi(self)

self.ui.listWidget.addItem(abcde)
self.ui.listWidget.addItem(áɬʔéí)


Make this a unicode string (Python 2.7):

self.ui.listWidget.addItem(uáɬʔéí)


if __name__ == __main__:
app = QtGui.QApplication(sys.argv)
myapp = MyForm()
myapp.show()
sys.exit(app.exec_())


notice that there are two additem() methods, one which adds straight
ASCII, the other which adds some non-ASCII