diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-18 22:06:09 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-18 22:06:09 +0000 |
commit | 10ece0d6ec524b349e501e5b5a8697e437617807 (patch) | |
tree | aa0228d5f2eb8ea6525042b2bf7e46854ae2756b | |
parent | 6ab5e6f77e99b7f713f5e02f22c4f77541fb239d (diff) |
force utf8 decoding for alot.rc
-rw-r--r-- | alot/settings.py | 3 | ||||
-rw-r--r-- | alot/widgets.py | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/alot/settings.py b/alot/settings.py index ada780da..e86dd80a 100644 --- a/alot/settings.py +++ b/alot/settings.py @@ -20,7 +20,8 @@ class ConfigError(Exception): def read_config(configpath=None, specpath=None): try: - config = ConfigObj(infile=configpath, configspec=specpath, file_error=True) + config = ConfigObj(infile=configpath, configspec=specpath, + file_error=True, encoding='UTF8') except (ConfigObjError, IOError), e: raise ConfigError('Could not read "%s": %s' % (configpath, e)) diff --git a/alot/widgets.py b/alot/widgets.py index 7c0d3e06..9ebc0f13 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -94,11 +94,11 @@ class ThreadlineWidget(urwid.AttrMap): if newest == None: datestring = u' ' * 10 else: - if config.has_option('general', 'timestamp_format'): - formatstring = settings.get('timestamp_format') - datestring = newest.strftime(formatstring) - else: + formatstring = settings.get('timestamp_format') + if formatstring is None: datestring = pretty_datetime(newest).rjust(10) + else: + datestring = newest.strftime(formatstring) self.highlight_theme_suffix = self._get_highlight_theme_suffix() self.date_w = urwid.AttrMap(urwid.Text(datestring), self._get_theme('date')) @@ -250,7 +250,7 @@ class TagWidget(urwid.AttrMap): self.highlight = theme representation = settings.get_tagstring_representation(tag) self.translated = representation['translated'] - self.txt = urwid.Text(self.translated.encode('utf-8'), wrap='clip') + self.txt = urwid.Text(self.translated, wrap='clip') self.normal_att = representation['normal'] self.focus_att = representation['focussed'] urwid.AttrMap.__init__(self, self.txt, self.normal_att, self.focus_att) |