I’m printing the first line from a file:
with open(path,"r",encoding='utf8') as f:
for i, l in enumerate(f.readlines()):
print(bytes(l.rstrip(), encoding='utf8'))
which I expect to output b’1′ but instead I’m getting:
b'\xef\xbb\xbf1'
what’s the issue here?
I’m on windows and I saved my file using notepad++.
The UTF-8 representation of the BOM is the byte sequence
0xEF,0xBB,0xBF. A text editor or web browser interpreting the text as ISO-8859-1 or CP1252 will display the characters  for this.BOM in
UTF-8is not needed. You can configure Notepad++.