Bug 1414060 - Give json.dump the correct encoding. r?Build
MozReview-Commit-ID: 6gzQq0kUYW0
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -234,19 +234,20 @@ class PartialConfigDict(object):
try:
with open(self._config_track) as fh:
existing_files.update(fh.read().splitlines())
except IOError:
pass
return existing_files
def _write_file(self, key, value):
+ encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8'
filename = mozpath.join(self._datadir, key)
with FileAvoidWrite(filename) as fh:
- json.dump(value, fh, indent=4)
+ json.dump(value, fh, indent=4, encoding=encoding)
return filename
def _fill_group(self, values):
# Clear out any cached values. This is mostly for tests that will check
# the environment, write out a new set of variables, and then check the
# environment again. Normally only configure ends up calling this
# function, and other consumers create their own
# PartialConfigEnvironments in new python processes.