summarylogtreecommitdiffstats
path: root/toprettyxml-and-unicode-fixes.patch
blob: f18406444730aa10aa232729f28c6c467ba4f5bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff -aur alacarte-3.7.90/Alacarte/MenuEditor.py alacarte-3.7.90.new/Alacarte/MenuEditor.py
--- alacarte-3.7.90/Alacarte/MenuEditor.py	2013-02-16 03:23:57.000000000 +0200
+++ alacarte-3.7.90.new/Alacarte/MenuEditor.py	2013-04-24 22:48:57.876017889 +0300
@@ -21,6 +21,7 @@
 import xml.dom.minidom
 import xml.parsers.expat
 from gi.repository import GMenu, GLib
+from xml.dom.ext import PrettyPrint
 from Alacarte import util
 
 def get_default_menu():
@@ -54,7 +55,7 @@
 
     def save(self):
         with codecs.open(self.path, 'w', 'utf8') as f:
-            f.write(self.dom.toprettyxml())
+            PrettyPrint(self.dom, stream=f)
 
     def restoreToSystem(self):
         self.restoreTree(self.tree.get_root_directory())
@@ -262,6 +263,7 @@
         out_path = os.path.join(util.getUserItemPath(), file_id)
 
         contents, length = keyfile.to_data()
+	contents = unicode(contents, 'utf8')
 
         with codecs.open(out_path, 'w', 'utf8') as f:
             f.write(contents)
@@ -402,6 +404,7 @@
             file_id = util.getUniqueFileId(keyfile.get_string(GLib.KEY_FILE_DESKTOP_GROUP, 'Name'), '.desktop')
 
         contents, length = keyfile.to_data()
+	contents = unicode(contents, 'utf8')
 
         path = os.path.join(util.getUserItemPath(), file_id)
         with codecs.open(path, 'w', 'utf8') as f:
@@ -424,6 +427,7 @@
         util.fillKeyFile(keyfile, kwargs)
 
         contents, length = keyfile.to_data()
+	contents = unicode(contents, 'utf8')
 
         path = os.path.join(util.getUserDirectoryPath(), file_id)
         with codecs.open(path, 'w', 'utf8') as f: