Source release v3.4.1
This commit is contained in:
5
third_party/gyp/easy_xml.py
vendored
5
third_party/gyp/easy_xml.py
vendored
@@ -4,6 +4,7 @@
|
||||
|
||||
import re
|
||||
import os
|
||||
import locale
|
||||
|
||||
|
||||
def XmlToString(content, encoding='utf-8', pretty=False):
|
||||
@@ -116,6 +117,10 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
|
||||
if win32 and os.linesep != '\r\n':
|
||||
xml_string = xml_string.replace('\n', '\r\n')
|
||||
|
||||
default_encoding = locale.getdefaultlocale()[1]
|
||||
if default_encoding and default_encoding.upper() != encoding.upper():
|
||||
xml_string = xml_string.decode(default_encoding).encode(encoding)
|
||||
|
||||
# Get the old content
|
||||
try:
|
||||
f = open(path, 'r')
|
||||
|
||||
Reference in New Issue
Block a user