From ee8e7cee3d458cedc4189e86453b6fed88958014 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Wed, 3 Sep 2014 01:03:38 +0200 Subject: [PATCH] pastoob: Add an option to set a custom file encoding --- weboob/applications/pastoob/pastoob.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/weboob/applications/pastoob/pastoob.py b/weboob/applications/pastoob/pastoob.py index 89d95065..30f65a77 100644 --- a/weboob/applications/pastoob/pastoob.py +++ b/weboob/applications/pastoob/pastoob.py @@ -143,7 +143,7 @@ class Pastoob(ReplApplication): if binary: m = open(filename) else: - m = codecs.open(filename, encoding=self.encoding) + m = codecs.open(filename, encoding=self.options.encoding or self.encoding) with m as fp: contents = fp.read() except IOError as e: @@ -212,3 +212,6 @@ class Pastoob(ReplApplication): group.add_option('-m', '--max-age', action='store', help='Maximum age (duration), default "1 month", "never" for infinite', type='string', default='1 month') + group.add_option('-E', '--encoding', action='store', + help='Input encoding', + type='string')