<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);" itemscope="" itemtype="https://schemas.microsoft.com/QuotedText">
<span class="x_elementToProof ContentPasted0" style="font-size: 12pt; background-color: rgb(255, 255, 255);">Hi,</span>
<div class="x_elementToProof" style="font-size: 12pt; background-color: rgb(255, 255, 255);">
<br class="ContentPasted0">
</div>
<div class="x_elementToProof ContentPasted0" style="font-size: 12pt; background-color: rgb(255, 255, 255);">
My specs:</div>
<div class="x_elementToProof" style="font-size: 12pt; background-color: rgb(255, 255, 255);">
<ul>
<li class="x_ContentPasted0 ContentPasted0">Windows 10 x64<br class="ContentPasted0">
</li><li class="x_ContentPasted0 ContentPasted0">Python 3.10.4</li><li class="x_ContentPasted0 x_ContentPasted1 ContentPasted0">PyQt 6.4.2</li><li class="x_ContentPasted0 x_ContentPasted1 x_ContentPasted2 ContentPasted0">QScintilla 2.13.4</li></ul>
<div class="x_ContentPasted3 ContentPasted0">In the attached example '<b><i class="ContentPasted0">qscintilla_settext_problem.py</i></b>', the text of '<b><i class="ContentPasted0">test.js</i></b>' is read into a QScintilla instance. Running it in a console
prints:</div>
<div class="x_ContentPasted3 x_ContentPasted4 x_ContentPasted6"><br class="ContentPasted0">
</div>
<div class="x_ContentPasted3 x_ContentPasted4 x_ContentPasted6"><i class="ContentPasted0">10438 -> line 20, text read from the file > print(len(text.split('\n')))<br class="x_ContentPasted4 ContentPasted0">
</i></div>
<div class="x_ContentPasted3 x_ContentPasted4 x_ContentPasted5 x_ContentPasted7">
<i class="ContentPasted0">1403 -> line 21, text read back from the QScintilla instance > print(len(editor.text().split('\n')))</i><br class="ContentPasted0">
</div>
<div class="x_ContentPasted3 x_ContentPasted4 x_ContentPasted5 x_ContentPasted7">
<br class="ContentPasted0">
</div>
<div class="x_ContentPasted3 x_ContentPasted4 ContentPasted0">but it should print 10438 in both cases. Which seems like QScintilla is chopping off part of the text.</div>
<div class="x_ContentPasted3 x_ContentPasted4 x_ContentPasted8 x_ContentPasted9 ContentPasted0">
The '<b><i class="x_ContentPasted8 ContentPasted0">test.js</i></b>' file was generated by the `<b><i class="ContentPasted0">emscripten</i></b>`
<b><i class="ContentPasted0">WASM </i></b>compiler.<br class="ContentPasted0">
</div>
<div class="x_ContentPasted3 x_ContentPasted4"><br class="ContentPasted0">
</div>
<span class="x_ContentPasted3 x_ContentPasted4 ContentPasted0">Any ideas why? Is this a bug in QScintilla/Scintilla perhaps?</span></div>
</blockquote>
There is a '<b><i>NUL</i></b>' character on line <b><i>1403 </i></b>that's causing this.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Is there a way to fix this?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Regards<br>
</div>
</body>
</html>