Victor Stinner [mailto:vstin...@python.org] wrote: > encoding="utf8" is backward compatible and is likely to fix encoding bugs > when the locale encoding is not UTF-8
This program runs just fine on 3.8.7 Windows, against a file.txt that contains latin-1 text: with open('file.txt', 'rt') as f: print(f.read()) But if I change it to this: with open('file.txt', 'rt', encoding='utf-8') as f: print(f.read()) then it fails with UnicodeDecodeError. How it that backwards compatible? regards, Anders _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/SDFLXIW64ESKDBARCHC2A2JA4NFPBZ2Y/ Code of Conduct: http://python.org/psf/codeofconduct/