javapackages-tools/0001-pom_editor-Write-temporary-XML-file-as-UTF-8.patch
2015-02-16 18:46:18 +01:00

28 lines
1.2 KiB
Diff

From 4374dc79828c75820d119ce221e95b74900afc52 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Mon, 16 Feb 2015 17:32:03 +0100
Subject: [PATCH] [pom_editor] Write temporary XML file as UTF-8
---
java-utils/pom_editor.py | 2 +-
test/data/pom_macros/pom_unicode.xml | 16 ++++++++++++++++
test/data/pom_macros/pom_unicode.xml-want | 16 ++++++++++++++++
test/pom_macros_test.py | 7 +++++++
4 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 test/data/pom_macros/pom_unicode.xml
create mode 100644 test/data/pom_macros/pom_unicode.xml-want
diff --git a/java-utils/pom_editor.py b/java-utils/pom_editor.py
index 1c30878..201ccf1 100644
--- a/java-utils/pom_editor.py
+++ b/java-utils/pom_editor.py
@@ -212,7 +212,7 @@ class XmlFile(object):
raw_xml = self._preprocess_raw(raw_xml)
self.xml_declaration = re.match(r'\<\?xml\s[^?]*\?\>', raw_xml)
tmpfile = self.xmlpath + '.tmp'
- with io.open(tmpfile, 'w') as prepared:
+ with io.open(tmpfile, 'w', encoding='UTF-8') as prepared:
prepared.write(raw_xml)
self.document = etree.parse(tmpfile)
self.tab = get_indent(self.root)