Blob Blame History Raw
From 592078e0386c2a36d50a6528b6e49d91707138bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20C=2E=20M=C3=BCller?= <scm@smurn.org>
Date: Thu, 21 Mar 2013 00:03:11 +0100
Subject: [PATCH] Error tolerant output decoding

Avoid throwing an exception if the program output is not valid unicode. Replace invalid bytes by the unicode replacement character.
---
 sphinxcontrib/programoutput.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sphinxcontrib/programoutput.py b/sphinxcontrib/programoutput.py
index 45078a6..3f6a4f1 100644
--- a/sphinxcontrib/programoutput.py
+++ b/sphinxcontrib/programoutput.py
@@ -159,7 +159,7 @@ def get_output(self):
         """
         process = self.execute()
         output = process.communicate()[0].decode(
-            sys.getfilesystemencoding()).rstrip()
+            sys.getfilesystemencoding(), 'replace').rstrip()
         return process.returncode, output
 
     def __str__(self):