From 39a06bc6092dad3130d349ddb573c666e745535c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henriques?= Date: Sun, 24 May 2015 15:11:30 -0700 Subject: [PATCH] gyp: fix for non-acsii userprofile name on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit 9f3a1b2ce62d2a703675b5474797583209602f7d Author: João Henriques Date: Tue Dec 17 21:14:18 2013 +0000 Update easy_xml.py Better handling of encoding commit a8b49423f7b477f7b9b363c69886150d9b83acc5 Author: João Henriques 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. --- gyp/pylib/gyp/easy_xml.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gyp/pylib/gyp/easy_xml.py b/gyp/pylib/gyp/easy_xml.py index bf949b6ac9..2b0bb60cb4 100644 --- a/gyp/pylib/gyp/easy_xml.py +++ b/gyp/pylib/gyp/easy_xml.py @@ -115,6 +115,11 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, xml_string = XmlToString(content, encoding, pretty) if win32 and os.linesep != '\r\n': xml_string = xml_string.replace('\n', '\r\n') + + try: + xml_string = xml_string.encode(encoding) + except Exception: + xml_string = unicode(xml_string, 'latin-1').encode(encoding) # Get the old content try: