[PyQt] QMessageBox with unicode text fails
Tim Welch
tim.j.welch at gmail.com
Wed Oct 24 23:03:20 BST 2007
Hi folks,
I'm trying to display a unicode string in a QMessageBox using the
information() static method. However it seems to only accept ascii
characters. I'm using qt/pyqt 4.3.0 on Windows.
Here's a sample app with output:
# *-* coding: utf-8 *-*
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
if __name__ == "__main__":
qapp = QApplication([])
QMessageBox.critical(None, "ImportError", unicode("blort español"))
sys.exit(qapp.exec_())
********************************************************
Traceback (most recent call last):
File "U:\dev\delphos\src\gui\test.py", line 8, in <module>
QMessageBox.critical(None, "ImportError", unicode("blort español"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10:
ordinal not in range(128)
*********************************************************
Removing the ñ creates a working message box. It makes no difference if I
use the static method or create and setup a QMessageBox object myself. Any
help is appreciated, I found no mention of this in any documentation or the
archives.
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071024/d07fcf49/attachment.html
More information about the PyQt
mailing list