This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use utf-8 in "Reading and Writing Files" tutorial.
Type: enhancement Stage:
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, methane
Priority: normal Keywords: newcomer friendly

Created on 2020-08-08 03:14 by methane, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg375033 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-08-08 03:14
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files

Current tutorial doesn't mention about encoding and example uses locale encoding.
Since UTF-8 is major text encoding and many Windows environment doesn't use UTF-8 by default, encoding should be mentioned in the tutorial and UTF-8 should be recommended.

Additionally, the paragraph about line ending conversion [1] can be removed. This was important in Python 2. But it is not important because (en|de)coding binary data is nonsense already.

[1]: "This behind-the-scenes modification to file data is fine for text files, but will corrupt binary data like that in JPEG or EXE files. Be very careful to use binary mode when reading and writing such files."
History
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85679
2020-08-08 03:14:44methanecreate