[wxPython-users] Re: wxStyledTextCtrl questions
Robin Dunn
robin at alldunn.com
Tue Mar 6 11:34:31 PST 2007
kib wrote:
>
>>> One more thing : I saw that the character "§" takes 2 colums when
>>> I make my stc show the current cursor position, is that a bug ?
>> The STC stores the document data internally as utf-8 so what you are
>> seeing as column offsets is actually related to character positions in
>> this buffer where some characters can occupy more than one byte.
>>
>
> Ok I see, now in the previous method, the match.start() and match.end()
> won't give good positions in my current stc if some characters take 2
> bytes and that's why I get bad highlighting I suppose, right ?
>
> If so, how can I solve this ?
The STC class has some helper methods that allow you to get/set the text
as UTF-8 strings, so you can either use those to assist you in working
with the text, or you can make your code aware of how unicode values are
converted to/from UTF-8 strings and react accordingly. Sorry, but I
don't have any examples for either of these approaches.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list