Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(224)

Unified Diff: Lib/distutils/file_util.py

Issue 1874048: Rewrite Python import machinery to use unicode
Patch Set: Created 1 year, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Lib/distutils/file_util.py
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py
index 3a71bfd1ac27c622549e9776cd8f4ab2cc6eed92..ceb16b3cd9403c2c0dcab4b319f6b554917dd390 100644
--- a/Lib/distutils/file_util.py
+++ b/Lib/distutils/file_util.py
@@ -225,7 +225,7 @@ def write_file(filename, contents):
"""Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
"""
- f = open(filename, "w")
+ f = open(filename, "w", encoding="utf-8", errors="surrogateescape")
Antoine Pitrou 2010/07/30 13:35:47 Why the hardcoding to utf-8?
haypo 2010/07/30 20:47:04 utf-8 is maybe not needed, only errors.
amaury 2010/07/31 11:33:01 What is this function used for?
merwok 2010/07/31 22:15:40 distutils is feature-frozen, and this is arguably
merwok 2010/08/10 21:40:30 Distutils writes files in UTF-8; it’s undocumented
for line in contents:
f.write(line + "\n")
f.close()

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 855:fffdfa546f68