diff options
author | Julian Mehne <julian.mehne@posteo.de> | 2018-02-15 00:32:52 +0100 |
---|---|---|
committer | Julian Mehne <julian.mehne@posteo.de> | 2018-02-15 01:00:28 +0100 |
commit | 041a4ccad95e4bb0da84a3194b12be5efdac653c (patch) | |
tree | 8361e18efba7293834380d1690c3d58cb0dff484 /alot | |
parent | 4a99e47f189f5806c035acf982ed46598ea9ad61 (diff) |
Fix non-ascii templates.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/globals.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 68f0a906..5d482a67 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -770,8 +770,11 @@ class ComposeCommand(Command): priority='error') return try: - with open(path) as f: - self.envelope.parse_template(f.read()) + with open(path, 'rb') as f: + blob = f.read() + encoding = helper.guess_encoding(blob) + logging.debug('template encoding: `%s`' % encoding) + self.envelope.parse_template(blob.decode(encoding)) except Exception as e: ui.notify(str(e), priority='error') return |