[QScintilla] Another QScintilla Unicode issue
Phil Thompson
phil at riverbankcomputing.com
Sat Aug 14 16:29:25 BST 2010
On Sun, 01 Aug 2010 01:22:03 +0100, Baz Walter <bazwal at ftml.net> wrote:
> On 31/07/10 17:25, detlev wrote:
>> Hi,
>>
>> if I show an autocompletion list or userlist with
>> QsciScintilla.showUserList(...) for a list that contains a string with
a
>> non-
>> ASCII character (e.g. 'Ü'), that character is not shown correctly and
is
>> not
>> returned correctly when selected (e.g. handleÜmlauts is shown as
>> handle�mlauts).
>
> i tried something like this:
>
> mylist = u'\xDC \xDD \xDE \xDF'
>
> if self.isUtf8():
> mylist = mylist.encode('utf-8')
> else:
> mylist = mylist.encode('latin-1')
>
> self.SendScintilla(self.SCI_USERLISTSHOW, 1, mylist)
>
> ...and the non-ascii characters were displayed correctly.
>
> so it looks like qscintilla's listbox is unicode-aware, but the
> showuserlist method is not.
It's SendScintilla() that's the issue. You should really treat Scintilla
like a file, ie. always be explicit about the encoding - so what you have
done is correct.
I may make it more restrictive (ie. more correct, but maybe at the cost of
breaking code) by requiring bytes objects (for Python3) and str objects
(for Python2), and no longer allowing str objects (for Python3) and unicode
objects (for Python2).
Phil
More information about the QScintilla
mailing list