I have wrote a simple code in python
s = b'B1=A\xF1adir+al+carrito\n'.decode('latin-1')
print(s)
with open ('lat.txt','wb') as f:
f.write(bytes(s,'latin-1'))
the output is B1=Añadir+al+carrito and the content of the file is also the same.
but when I try to read from a file (with this content B1=A\xF1adir+al+carrito )
for lines in open('mytxt1.txt','rb'):
print(lines)
s = lines.decode('latin-1')
print(s)
with open ('lat1.txt','wb') as f:
f.write(bytes(s,'latin-1'))
I don't get the output B1=Añadir+al+carrito but instead I get B1=A\xF1adir+al+carrito,
and the file empty,
any idea whta should I do?