<div dir="ltr">I just tried your example using decode(), and it works fine on Linux.<div>I got the infamous square when using with Wine, though; the same happens when I just paste the correctly encoded text (copied from the linux-run test), so I don't know if it's only a Wine issue, but you could try the same and see if the unicode character shows up.<br>If that's the case, you should consider using encoded unicode strings by default ( u'unicode string' ) or, maybe, using QString.fromUtf8 if you're still using QString v1 api.</div><div>If the character doesn't show up instead, it might be a font issue (I don't know much about font handling on windows, maybe you should specify a different family?).</div><div><br></div><div>MaurizioB</div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno sab 18 ago 2018 alle ore 01:51 inhahe <<a href="mailto:inhahe@gmail.com">inhahe@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net">http://www.jidesk.net</a></div>