[PyQt] Python3 Qt4 and string encoding issues

rohan at kde.org rohan at kde.org
Tue Apr 15 09:56:13 BST 2014


On Monday, April 14, 2014 05:16:48 PM rohan at kde.org wrote:
> Hi everyone
> I've encountered this bug [1] and I've narrowed it down to a issue in Python
> Qt.
> 
> Here's a test program that I ran :
> 
> from PyQt4 import QtGui,QtCore
> import sys
> app = QtGui.QApplication(sys.argv)
> combobox = QtGui.QComboBox()
> combobox.addItem("Română")
> combobox.setCurrentIndex(0)
> print(str(combobox.currentText()))
> 
> foo = "Română"
> print(foo)
> 
> On my terminal I get :
> 
> Român
> Română
> 
> The accent on the ă seems to be lost on my machine when using QComboBox.
> Could someone advice on how to use accented characters with QComboBox
> items?
> 
> Cheers
> Rohan Garg
> 
> [1] https://launchpad.net/bugs/1298251

Just a small follow up, the string is correctly encoded in the combobox , so 
it's only the conversion back from a QString to a python string that is 
troublesome.

Cheers
Rohan Garg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140415/c3337038/attachment.pgp>


More information about the PyQt mailing list