I need to read a file in binary format, which I do like this:
with open("tex.pdf", mode='br') as file:
fileContent = file.read()
for i in fileContent:
print(i,end=" ")
This provides decimal integers, which I think are in ASCII format. However ASCII values cover only 0..127, whereas this output displays integers greater than 127, such as 225, 108, 180, and 193.
Can someone tell me what encoding/mechanism is used?
There is no encoding for reading raw bytes so you have to decode yourself with a specified encoding.
Documentation:
Example:
The text uses only ascii characters but the encoding is utf-16. I have to decode manually the raw bytes data.