Hi guys,
I've been reading up on unicode and character encoding a bit today and
just when I thought I had a vague idea how it all works I ran into this
problem:
I am retrieving unicode from a website, which I need to format a little,
then display as a widget's tooltip.
When I print out my formatted string I get the special characters I
expect, but when I use the same string as a tooltip, it displays a "å"
character instead.
Here is a screen shot of what I'm seeing:
And below is a simple test that shows my problem.
Can somebody please explain to me what is going on here and how I should
be handle this properly?
Cheers,
frank
import sys
from PySide import QtGui
quotationMark = u'\u201c'
myText = 'special charactes cause headaches:
{}'.format(quotationMark.encode('utf-8'))
print myText # this prints the crrect special character (quotation mark)
app = QtGui.QApplication([])
w = QtGui.QWidget()
w.setToolTip(myText) # this just ends up displaying a "å" character
w.show()
w.raise_()
sys.exit(app.exec_())
--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation
and consulting <http://ohufx.com/index.php/vfx-customising>* *
_______________________________________________
PySide mailing list
PySide@qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside