From 30c22ebf51c61ede924a7b81edd4ac44d55aa5a8 Mon Sep 17 00:00:00 2001 From: Remco Boerma Date: Wed, 16 Mar 2016 21:32:41 +0100 Subject: [PATCH] error wasn't ignored when ordered to do so ignore codepage errors on `errors='ignore'` when reading rtf. --- pyth/plugins/rtf15/reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyth/plugins/rtf15/reader.py b/pyth/plugins/rtf15/reader.py index 7a74162..29f83e6 100644 --- a/pyth/plugins/rtf15/reader.py +++ b/pyth/plugins/rtf15/reader.py @@ -469,7 +469,10 @@ def handle_ansicpg(self, codepage): if codepage in _CODEPAGES_BY_NUMBER: self.charset = self.reader.charset = _CODEPAGES_BY_NUMBER[codepage] else: - raise ValueError("Unknown codepage %s" % codepage) + if self.reader.errors == 'ignore': + pass + else: + raise ValueError("Unknown codepage %s" % codepage) def handle_fonttbl(self):