<div dir="ltr">I can display UTF-8 when I use wxPython:<div>------</div><div><div>import wx</div><div>app = wx.App()</div><div>s = 'testing\xf0\x9f\x98\x80'</div><div>frame = wx.Frame(None, wx.ID_ANY)</div><div>font = wx.Font("Arial")</div><div>textbox = wx.TextCtrl(frame, id=wx.ID_ANY)</div><div>textbox.SetFont(font)</div><div>textbox.WriteText(s)</div><div>frame.Show()</div><div>app.MainLoop()</div></div><div>------</div><div>But when I try the same thing with PyQt4..</div><div>------</div><div><div>from PyQt4 import QtGui</div><div>import sys</div><div>s = 'testing\xf0\x9f\x98\x80'</div><div>app = QtGui.QApplication(sys.argv)<br></div><div>w = QtGui.QWidget()</div><div>font = QtGui.QFont("Arial")</div><div>textbox = QtGui.QLineEdit(w)</div><div>textbox.setFont(font)</div><div>textbox.setText(s)</div><div>w.show()</div><div>sys.exit(app.exec_())</div></div><div>------</div><div>Instead of "testing😀" ("testing" with a smiley face after it, if you can't see it in this message), I get "testingð" ("testing", then an o with some kind of mark above it).</div><div><br></div><div>I tried replacing </div><div>------</div><div>s = 'testing\xf0\x9f\x98\x80'</div><div>------</div><div>with </div><div>------</div><div>s = 'testing\xf0\x9f\x98\x80'.decode('UTF-8')</div><div>------</div><div>in case PyQt takes Unicode instead of UTF-8, but in that case I get "testing" and then a little square after it (like the character isn't found in the font). If I copy it and paste it here I get "testing😀" ("testing" with a smiley face after it, like I want), so I guess displaying it in the font is the problem, but I don't know why.. as you can see, both the wxPython and the PyQt4 programs use "Arial". I've also tried "FixedSys Excelsior 3.01".</div><div><br></div><div>Python version: CPython 2.7.14</div><div>OS: Windows 10 </div><div><br></div><div>thanks for any help!</div></div>