diff --git a/xdg-menu b/xdg-menu index 4f16438..aefc6a4 100644 --- a/xdg-menu +++ b/xdg-menu @@ -52,21 +52,24 @@ def icon_attr(entry): return ' icon="' + iconfile + '"' return '' +def escape_utf8(s): + return escape(s.encode('utf-8', 'xmlcharrefreplace')) + def entry_name(entry): - return escape(entry.getName().encode('utf-8', 'xmlcharrefreplace')) + return escape_utf8(entry.getName()) def walk_menu(entry): if isinstance(entry, xdg.Menu.Menu) and entry.Show is True: print '
' elif isinstance(entry, xdg.Menu.MenuEntry) and entry.Show is True: print '