[PyQt] PyQt4 - QChar - unicode char?

Phil Thompson phil at riverbankcomputing.com
Sat Oct 5 22:26:34 BST 2013


On Sat, 5 Oct 2013 13:10:42 -0700, David Cortesi <davecortesi at gmail.com>
wrote:
> # python 2.7
> from future import unicode_literals
> uu = u'\u2019' # no problem here but...
> qcCurlyApostrophe = QChar(uu)
> Traceback (most recent call last):
>     File "<string>", line 1, in <fragment>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in
> position 0: ordinal not in range(128)
> qcCurlyApostrophe = QChar(8217) # int workaround ok
> 
> So - user error?

Yes.

> Or failure to recognize the "QChar::QChar(uchar ch)"
> overload signature?

ch is defined as an ASCII/Latin1 character.

Phil


More information about the PyQt mailing list