summaryrefslogtreecommitdiff
path: root/SCons/Tool/textfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'SCons/Tool/textfile.py')
-rw-r--r--SCons/Tool/textfile.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/SCons/Tool/textfile.py b/SCons/Tool/textfile.py
index 7fdc8b7be..c960e67cf 100644
--- a/SCons/Tool/textfile.py
+++ b/SCons/Tool/textfile.py
@@ -117,9 +117,14 @@ def _action(target, source, env):
value = str(value)
subs.append((k, value))
+ if 'FILE_ENCODING' not in env:
+ file_encoding = 'utf-8'
+ else:
+ file_encoding = env['FILE_ENCODING']
+
# write the file
try:
- target_file = open(target[0].get_path(), TEXTFILE_FILE_WRITE_MODE, newline='')
+ target_file = open(target[0].get_path(), TEXTFILE_FILE_WRITE_MODE, newline='', encoding=file_encoding)
except (OSError, IOError) as e:
raise SCons.Errors.UserError("Can't write target file %s [%s]" % (target[0],e))