>  On 25 Apr 2017, at 5:08 pm, Matic Kukovec <[email protected]> wrote:
>  >
>  > Hi guys,
>  >
>  > I just noticed that when adding strings that contain null characters 
> ('\0') using the setText method,
>  > QScintilla cuts off the string at the first null character it finds. To be 
> sure I opened the same text saved
>  > to a file with Notepad++ and SciTE and there the null characters appear.
>  >
>  > Is this a bug or should strings with null characters be handled 
> differently?
>  > I used this example to for testing:
>  > qscieditor.setText("Test\nText\nIn\n\0An\nQscintilla\nEditor")
>
>  Is that C++ or Python?
>
>  setText() uses the low-level Scintilla SCI_SETTEXT which accepts a '\0' 
> string, ie. you will get the same result if you used Scintilla.
>
>  Phil

Hi Phil,

I'm using Python3 and before I tried setText and now I tried as you suggested:
qscieditor.SendScintilla(SCI_SETTEXT, 
bytes("Test\nText\nIn\n\0An\nQscintilla\nEditor", encoding="ascii"))
and I get the same result.
I looked into the C++ setText method and it uses this line:
SendScintilla(SCI_SETTEXT, ScintillaBytesConstData(textAsBytes(text)));
Is there maybe an error in how the ScintillaBytesConstData or textAsBytes 
convert the text?
I'm only guessing here.

Thanks,
Matic
_______________________________________________
QScintilla mailing list
[email protected]
https://www.riverbankcomputing.com/mailman/listinfo/qscintilla

Reply via email to