VMM{/cli}/config: Explicitly pass utf-8 as the encoding to open(). v0.7.x
authorPascal Volk <user@localhost.localdomain.org>
Sun, 02 Dec 2012 15:51:17 +0000
branchv0.7.x
changeset 658 ad967c4b7fe5
parent 657 6515e3b88dec
child 659 a6b6b0937cae
VMM{/cli}/config: Explicitly pass utf-8 as the encoding to open().
VirtualMailManager/cli/config.py
VirtualMailManager/config.py
--- a/VirtualMailManager/cli/config.py	Sun Dec 02 14:54:24 2012 +0000
+++ b/VirtualMailManager/cli/config.py	Sun Dec 02 15:51:17 2012 +0000
@@ -89,7 +89,7 @@
     def _save_changes(self):
         """Writes changes to the configuration file."""
         copy2(self._cfg_filename, self._cfg_filename + '.bak')
-        with open(self._cfg_filename, 'w') as self._cfg_file:
+        with open(self._cfg_filename, 'w', encoding='utf-8') as self._cfg_file:
             self.write(self._cfg_file)
 
 del _
--- a/VirtualMailManager/config.py	Sun Dec 02 14:54:24 2012 +0000
+++ b/VirtualMailManager/config.py	Sun Dec 02 15:51:17 2012 +0000
@@ -358,7 +358,7 @@
         Raises a ConfigError if the configuration syntax is
         invalid.
         """
-        with open(self._cfg_filename, 'r') as self._cfg_file:
+        with open(self._cfg_filename, 'r', encoding='utf-8') as self._cfg_file:
             try:
                 self.readfp(self._cfg_file)
             except (MissingSectionHeaderError, ParsingError) as err: