[QScintilla] QScintilla issue

Phil Thompson phil at riverbankcomputing.com
Sat Aug 14 13:37:41 BST 2010


On Fri, 13 Aug 2010 11:13:53 +0200, Detlev Offenbach
<detlev at die-offenbachs.de> wrote:
> On Donnerstag, 12. August 2010, Detlev Offenbach wrote:
>> Hi,
>> 
>> I am observing an issue with QScintilla when it has to handle "strange"
>> characters like German umlauts or Chines characters. Enter the
following
>> in
>> a Python (2 or 3) console to reproduce it.
>> 
>> Python 3.1 (r31:73572, Jul  5 2010, 13:31:53)
>> [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> 
>> >>> from PyQt4.QtGui import QApplication
>> >>> from PyQt4.Qsci import QsciScintilla
>> >>> app = QApplication([])
>> >>> s = QsciScintilla()
>> >>> e = "a"
>> >>> s.SendScintilla(QsciScintilla.SCI_SEARCHINTARGET, len(e), e)
>> 
>> -1
>> 
>> >>> e = "ä"
>> >>> s.SendScintilla(QsciScintilla.SCI_SEARCHINTARGET, len(e), e)
>> 
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>> TypeError: arguments did not match any overloaded call:
>>   QsciScintillaBase.SendScintilla(int, int wParam=0, int lParam=0):
>> argument 3 has unexpected type 'str'
>>   QsciScintillaBase.SendScintilla(int, int, sip.voidptr): argument 3
has
>> unexpected type 'str'
>>   QsciScintillaBase.SendScintilla(int, int, str): argument 3 has
>>   unexpected
>> type 'str'
>>   QsciScintillaBase.SendScintilla(int, str): argument 2 has unexpected
>>   type
>> 'int'
>>   QsciScintillaBase.SendScintilla(int, str, str): argument 2 has
>>   unexpected
>> type 'int'
>>   QsciScintillaBase.SendScintilla(int, int): too many arguments
>>   QsciScintillaBase.SendScintilla(int, int, int, str): argument 3 has
>> unexpected type 'str'
>>   QsciScintillaBase.SendScintilla(int, int, QColor): argument 3 has
>> unexpected type 'str'
>>   QsciScintillaBase.SendScintilla(int, QColor): argument 2 has
unexpected
>> type 'int'
>>   QsciScintillaBase.SendScintilla(int, int, QPainter, QRect, int, int):
>> argument 3 has unexpected type 'str'
>>   QsciScintillaBase.SendScintilla(int, int, QPixmap): argument 3 has
>> unexpected type 'str'
>> 
>> 
>> Regards,
>> Detlev
> 
> The issue does not happen, if the string is encoded first (i.e. 
> e='ä'.encode('utf-8') ).

Strictly speaking it's not a bug - but there is a bug in the exception
text - it should say that the string cannot be converted to ASCII.

However, SIP is capable of doing the conversion for you with the right
/Encoding/ annotation - so it should work as you are expecting in tonight's
snapshot.

Phil


More information about the QScintilla mailing list