Fix unicode coding error in android build target

Using Python 2.7, attempting to run `encode(utf-8)` was throwing `write() argument 1 must be unicode, not str`.

As the file being written has `encoding='utf-8'`, I'm assuming the intention was to decode the lines from an `str` into a unicode string, and I believe that's what this change does.

Please let me know if I've misinterpreted something. Making this change fixed my build locally. Also not sure where I should be targeting this.
This commit is contained in:
Jamie Alexandre 2017-06-27 13:43:44 -07:00 committed by GitHub
parent 480e726011
commit 7b87d80560

View file

@ -851,7 +851,7 @@ class TargetAndroid(Target):
# recreate the project.properties
with io.open(project_fn, 'w', encoding='utf-8') as fd:
try:
fd.writelines((line.encode('utf-8') for line in content))
fd.writelines((line.decode('utf-8') for line in content))
except:
fd.writelines(content)
if not content[-1].endswith(u'\n'):