diff options
author | mathieui <mathieui@mathieui.net> | 2012-09-13 09:48:35 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-09-13 09:50:48 +0200 |
commit | 0bd55a27f2f14dd434c828f4a061f366b39dda92 (patch) | |
tree | 3fc157c7ae71c0c100fa201ab2ef96bdf7411097 /src/config.py | |
parent | c2828cdd29749609b4e16d2d461ac6b39c822573 (diff) | |
download | poezio-0bd55a27f2f14dd434c828f4a061f366b39dda92.tar.gz poezio-0bd55a27f2f14dd434c828f4a061f366b39dda92.tar.bz2 poezio-0bd55a27f2f14dd434c828f4a061f366b39dda92.tar.xz poezio-0bd55a27f2f14dd434c828f4a061f366b39dda92.zip |
Fix TBs when the system is not in utf-8 by default
(force every file opening to be with the utf-8 encoding)
Diffstat (limited to 'src/config.py')
-rw-r--r-- | src/config.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/config.py b/src/config.py index 8a0c322c..6bcc139e 100644 --- a/src/config.py +++ b/src/config.py @@ -24,7 +24,7 @@ class Config(RawConfigParser): def __init__(self, file_name): self.file_name = file_name RawConfigParser.__init__(self, None) - RawConfigParser.read(self, file_name) + RawConfigParser.read(self, file_name, encoding='utf-8') # Check config integrity and fix it if it’s wrong for section in ('bindings', 'var'): if not self.has_section(section): @@ -115,7 +115,7 @@ class Config(RawConfigParser): exist """ if path.exists(self.file_name): - df = open(self.file_name, 'r') + df = open(self.file_name, 'r', encoding='utf-8') lines_before = (line.strip() for line in df.readlines()) df.close() else: @@ -148,7 +148,7 @@ class Config(RawConfigParser): result_lines.append('%s = %s' % (option, value)) - df = open(self.file_name, 'w') + df = open(self.file_name, 'w', encoding='utf-8') for line in result_lines: df.write('%s\n' % line) df.close() |