[damned-lies] Prevented UnicodeDecodeError in diff content



commit f76e591c54d72852d5a624d6401f690436ff3bd3
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Dec 15 10:20:08 2016 +0100

    Prevented UnicodeDecodeError in diff content

 stats/potdiff.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/stats/potdiff.py b/stats/potdiff.py
index c74ae3f..fe37444 100644
--- a/stats/potdiff.py
+++ b/stats/potdiff.py
@@ -19,18 +19,19 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 # Output differences between two POT files
+from __future__ import unicode_literals
 
 USE_DIFFLIB = 0
 
 def diff(pota, potb):
     """Returns a list of differing lines between two files."""
     with open(pota, "r") as f1:
-        data1 = f1.read()
+        data1 = f1.read().decode('utf-8')
     res1 = _parse_contents(data1)
     res1.sort()
 
     with open(potb, "r") as f2:
-        data2 = f2.read()
+        data2 = f2.read().decode('utf-8')
     res2 = _parse_contents(data2)
     res2.sort()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]