[PyQt] Surrogate pair inside HTML paragraph with id is shown incorrectly

Phil Thompson phil at riverbankcomputing.com
Sun Oct 5 12:10:01 BST 2014


On 30/09/2014 2:41 am, Conrado P. L. GouvĂȘa wrote:
> Hi,
> 
> This is a very odd bug, but easy to reproduce: (Windows 7, Python
> 2.7.8 32-bit, PyQt4 4.11.2)
> 
> local_app = QApplication([])
> buf = u'<html><body><p
> id="main">\U0001f604\U0001f604\U0001f604\U0001f604\U0001f604</p></body></html>'
> lbl = QTextBrowser()
> lbl.setFont(QtGui.QFont("Segoe UI Symbol"))
> lbl.setHtml(buf)
> lbl.show()
> local_app.exec_()
> 
> 
> The code above shows two boxes followed by four smilies, when it
> should be five smilies. If you remove the "id" attribute of the <p>
> tag, the problem vanishes (e.g.:
> buf =
> u'<html><body><p>\U0001f604\U0001f604\U0001f604\U0001f604\U0001f604</p></body></html>'
> ). It also vanishes if you add e.g. a letter before the unicode smilie.
> 
> Any idea what's going on?

No, but I don't really see how this might be a PyQt (rather than Qt) 
problem.

Phil


More information about the PyQt mailing list