summaryrefslogtreecommitdiff
path: root/Mozo/MainWindow.py
diff options
context:
space:
mode:
authorAlexei Sorokin <[email protected]>2016-08-22 23:56:13 +0300
committerAlexei Sorokin <[email protected]>2016-08-22 23:56:13 +0300
commit97c5474bfa5c3a4d9f72dc8cba87d8e9ba79813f (patch)
treec6210b5336b7d6722e69b28dbf53e66050cde616 /Mozo/MainWindow.py
parent2f6ec7aabdeaf6575f93dbe71d08df98aa13cda2 (diff)
downloadmozo-97c5474bfa5c3a4d9f72dc8cba87d8e9ba79813f.tar.bz2
mozo-97c5474bfa5c3a4d9f72dc8cba87d8e9ba79813f.tar.xz
encode with utf-8 before writing XML
based on: https://github.com/GNOME/alacarte/commit/f7835d7 https://github.com/GNOME/alacarte/commit/0d7f351
Diffstat (limited to 'Mozo/MainWindow.py')
-rw-r--r--Mozo/MainWindow.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Mozo/MainWindow.py b/Mozo/MainWindow.py
index 367b9c8..176c410 100644
--- a/Mozo/MainWindow.py
+++ b/Mozo/MainWindow.py
@@ -22,7 +22,9 @@ gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import GLib, Gio
from gi.repository import Gtk, Gdk, GdkPixbuf
-import cgi, os
+import cgi
+import codecs
+import os
import gettext
import subprocess
import urllib
@@ -375,7 +377,8 @@ class MainWindow:
if not os.path.isfile(file_path):
data = open(item.get_desktop_file_path()).read()
- open(file_path, 'w').write(data)
+ with codecs.open(file_path, 'w') as f:
+ f.write(data)
self.editor._MenuEditor__addUndo([(file_type, os.path.split(file_path)[1]),])
else:
self.editor._MenuEditor__addUndo([item,])