diff --git a/pylib/gyp/easy_xml.py b/pylib/gyp/easy_xml.py index bda1a474..41fb3c7c 100644 --- a/pylib/gyp/easy_xml.py +++ b/pylib/gyp/easy_xml.py @@ -123,7 +123,10 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, default_encoding = locale.getdefaultlocale()[1] if default_encoding and default_encoding.upper() != encoding.upper(): - xml_string = xml_string.encode(encoding) + if sys.platform == "win32": + if isinstance(xml_string, str): + xml_string = xml_string.decode("cp1251") # str --> bytes + xml_string = xml_string.encode(encoding) # bytes --> str # Get the old content try: