Skip to content

Commit 39a06bc

Browse files
jfhenriquesTooTallNate
authored andcommitted
gyp: fix for non-acsii userprofile name on Windows
Squashed commit of the following: commit 9f3a1b2 Author: João Henriques <[email protected]> Date: Tue Dec 17 21:14:18 2013 +0000 Update easy_xml.py Better handling of encoding commit a8b4942 Author: João Henriques <[email protected]> Date: Thu Dec 12 04:09:38 2013 +0000 Quick and dirty fix to allow WriteXmlIfChanged to write xml in utf-8, converting latin-1 directory paths. Closes #366. Closes #554. Fixes #297. Fixes #404. Fixes #476.
1 parent 5f4b185 commit 39a06bc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gyp/pylib/gyp/easy_xml.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
115115
xml_string = XmlToString(content, encoding, pretty)
116116
if win32 and os.linesep != '\r\n':
117117
xml_string = xml_string.replace('\n', '\r\n')
118+
119+
try:
120+
xml_string = xml_string.encode(encoding)
121+
except Exception:
122+
xml_string = unicode(xml_string, 'latin-1').encode(encoding)
118123

119124
# Get the old content
120125
try:

0 commit comments

Comments
 (0)