Charly Dante
2014-05-18 11:08:58 UTC
Hi there,
I'm currently trying to get the correct text from my Scintilla Control in
UTF8 encoding, but until now I fail to do so.
I have used the option SendMessage(my_sci_window, SCI_SETCODEPAGE,
SC_CP_UTF8, 0); to enable all Unicode chars like russian or chinese for my
edit control. These characters are displayed correct when entered to the
Scintilla Control.
However, if I try to get the whole text of the Scintilla Control, I only
get Garbage values for the chars that were Chinese/Russian Symbols. I use
this code to get the Scintilla Text:
size_t text_length = SendMessage(my_sci_window, WM_GETTEXTLENGTH, 0, 0);
char *buffer = new char[text_length + 1];
SendMessage(my_sci_window, WM_GETTEXT, text_length + 1,
reinterpret_cast<LPARAM>(buffer));
I tried both WM_GETTEXT and SCI_GETTEXT, but without finding any
difference. Also converting the char buffer array to a wchar_t buffer array
using mbstowcs_s doesn't help. As soon as the Scintilla Control contains
any "non-normal" chars like Chinese/Thai etc., they are translated to some
broken chars and I cannot get the correct text of the Scintilla control.
Any Idea how to fix this?
Best,
CD
I'm currently trying to get the correct text from my Scintilla Control in
UTF8 encoding, but until now I fail to do so.
I have used the option SendMessage(my_sci_window, SCI_SETCODEPAGE,
SC_CP_UTF8, 0); to enable all Unicode chars like russian or chinese for my
edit control. These characters are displayed correct when entered to the
Scintilla Control.
However, if I try to get the whole text of the Scintilla Control, I only
get Garbage values for the chars that were Chinese/Russian Symbols. I use
this code to get the Scintilla Text:
size_t text_length = SendMessage(my_sci_window, WM_GETTEXTLENGTH, 0, 0);
char *buffer = new char[text_length + 1];
SendMessage(my_sci_window, WM_GETTEXT, text_length + 1,
reinterpret_cast<LPARAM>(buffer));
I tried both WM_GETTEXT and SCI_GETTEXT, but without finding any
difference. Also converting the char buffer array to a wchar_t buffer array
using mbstowcs_s doesn't help. As soon as the Scintilla Control contains
any "non-normal" chars like Chinese/Thai etc., they are translated to some
broken chars and I cannot get the correct text of the Scintilla control.
Any Idea how to fix this?
Best,
CD
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.