summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-03-06 15:15:42 -0800
committerDylan Baker <dylan@pnwbakers.com>2018-03-06 15:15:42 -0800
commitd47ffba75d26cc599c790be9de35c37681fb70e7 (patch)
tree74675533f393b927daf708f04d66201826c29667 /alot
parentf226d76f84f608a9dceec8c47954017fbaa60de2 (diff)
use helper.try_decode instead of guess_encoding
basically just remove hand rolling what try_decode does.
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 49b61b4d..2916793f 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -772,10 +772,8 @@ class ComposeCommand(Command):
return
try:
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))
+ template = helper.try_decode(f.read())
+ self.envelope.parse_template(template)
except Exception as e:
ui.notify(str(e), priority='error')
return
@@ -846,10 +844,9 @@ class ComposeCommand(Command):
else:
with open(sig) as f:
sigcontent = f.read()
- enc = helper.guess_encoding(sigcontent)
mimetype = helper.guess_mimetype(sigcontent)
if mimetype.startswith('text'):
- sigcontent = helper.string_decode(sigcontent, enc)
+ sigcontent = helper.try_decode(sigcontent)
self.envelope.body += '\n' + sigcontent
else:
ui.notify('could not locate signature: %s' % sig,