Robert Roessler:

> Note that Scintilla supports UTF-8 encoding of Unicode - so the
> buffers are still [sort of] dealing with chars.

   Scintilla does not support UTF-16 or UTF-32. Scintilla's support
for UTF-8 does not attempt to view the text as a stream of characters
but rather as a stream of octets (the C char type) that make up
characters. Each character may contain between 1 and 3 octets and the
positions of character starts may be found using SCI_POSITIONBEFORE
and SCI_POSITIONAFTER.

   Most of the time you are retrieving text based on positions
returned from Scintilla such as the selection which should be a range
of whole characters and can be retrieved by allocating a char buffer
SelectionStart-SelectionEnd+1 long, retrieving the selection range
into that buffer, and converting from UTF-8 to UTF-16 using
MultiByteToWideChar or similar.

   For an example of retrieving text to use in find and replace
dialogs, look in scite/win32/SciTEWinDlg.cxx for SetDlgItemText2 and
its callers although it is made more complex by supporting other code
pages and by Windows 9x where unicode support is limited.

   Neil

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to