I have stumbled on similar behavior just this week. I don't have the original 
file for which it happened, but it turns out it is really simple to generate 
file that reproduces this:
```bash
echo "here comes the null:_more text here" | sed 's/_/\x00/' > /tmp/test.txt
```
Just to check that it is really written as intended:
```
$ hexdump -C /tmp/test.txt 
00000000  68 65 72 65 20 63 6f 6d  65 73 20 74 68 65 20 6e  |here comes the n|
00000010  75 6c 6c 3a 00 6d 6f 72  65 20 74 65 78 74 20 68  |ull:.more text h|
00000020  65 72 65 0a                                       |ere.|
00000024
```
Opening it with `geany -c /tmp/empty_dir -v /tmp/test.txt` shows only the text 
up to "here comes the null:" and the rest is truncated.  The debug messages on 
the stdout appear as if the file passed as valid UTF-8.

Also: While I was testing this, sometimes pretty similar files opened as 
UTF-16LE, which totally scrambled the contents. Unfortunately, I can't 
reproduce that now, even if I try to generate the file exactly the same as 
before. It almost feels like it depends on how things happen to be layed out in 
memory or something else undefined behaviorish. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/3700#issuecomment-1824922422
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/issues/3700/[email protected]>

Reply via email to