diff options
Diffstat (limited to 'coverage/html.py')
-rw-r--r-- | coverage/html.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/coverage/html.py b/coverage/html.py index 6c81110..85f47ab 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -238,15 +238,9 @@ class HtmlReporter(Reporter): })) if sys.version_info < (3, 0): - try: - html = html.decode(encoding) - except UnicodeDecodeError as e: - sample = e.object[max([0, e.start-30]):e.start+30] - raise CoverageException( - "Couldn't decode %r as %s: %r" % ( - cu.filename, e.encoding, sample - ) - ) + # In theory, all the characters in the source can be decoded, but + # strange things happen, so use 'replace' to keep errors at bay. + html = html.decode(encoding, 'replace') html_filename = flat_rootname + ".html" html_path = os.path.join(self.directory, html_filename) |