commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 05/06: grc: save grc files utf-8 encoded (#


From: git
Subject: [Commit-gnuradio] [gnuradio] 05/06: grc: save grc files utf-8 encoded (#792)
Date: Sun, 14 Jun 2015 16:34:14 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch maint
in repository gnuradio.

commit 42c892c92d13ba8803983db118f018e5d6b9f9b9
Author: Sebastian Koslowski <address@hidden>
Date:   Tue Jun 2 16:14:31 2015 +0200

    grc: save grc files utf-8 encoded (#792)
---
 grc/base/ParseXML.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/grc/base/ParseXML.py b/grc/base/ParseXML.py
index c9dbccf..2d5fed0 100644
--- a/grc/base/ParseXML.py
+++ b/grc/base/ParseXML.py
@@ -123,8 +123,9 @@ def to_file(nested_data, xml_file):
         xml_data += etree.tostring(etree.ProcessingInstruction(
             'grc', ' '.join(
                 "{0}='{1}'".format(*item) for item in instructions.iteritems())
-        ), xml_declaration=True, pretty_print=True)
-    xml_data += etree.tostring(_to_file(nested_data)[0], pretty_print=True)
+        ), xml_declaration=True, pretty_print=True, encoding='utf-8')
+    xml_data += etree.tostring(_to_file(nested_data)[0],
+                               pretty_print=True, encoding='utf-8')
     with open(xml_file, 'w') as fp:
         fp.write(xml_data)
 
@@ -147,7 +148,7 @@ def _to_file(nested_data):
         for value in values:
             node = etree.Element(key)
             if isinstance(value, (str, unicode)):
-                node.text = value
+                node.text = unicode(value)
             else:
                 node.extend(_to_file(value))
             nodes.append(node)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]