From b0235c425856571409c7de4c5d0dc21538d2ee62 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 19 2015 10:06:06 +0000 Subject: Let's decode the string received instead of encoding it This should make more sense, we may have retrieved bytes from pygit2, thus we try to decode it and find out if it is a text file or not --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 385ff16..76b7e60 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -2440,7 +2440,7 @@ def could_be_text(text): """ Returns wether we think this chain of character could be text or not """ try: - text.encode('utf-8') + text.decode('utf-8') return True except: return False