I'm having trouble reading and writing the nul
values in a binary file to a string.
The file I have is a MS Word file. I have converted it into a binary file and had a look at it in vscode, but in some parts of the file there are red highlights of smaller combined characters. Here is what the binary file looks like in VSCode:
And this is what the file looks like in NotePad:
This is what the first 5 characters of the file look like in binary when converted in python:
1010000 1001011 11 100 10100
The problem with this is Python is ignoring the parts highlighted in red. I understand that those parts like nul
are very important, but why is Python skipping them, or at the very least changing their values, and is there a way to allow python to copy the exact contents of the file, including those red parts?
I have tested other files before ranging from .jpg
to .ppt
, but none of them have ever done this before.
Thanks in advance and have a great day!