From c46506f1d6178fd43158fef24112a0e1747f9236 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Fri, 26 Aug 2016 08:20:29 -0400 Subject: [PATCH] Fix encoding detection. --- src/usr/bin/diffuse | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index 9add28e..92fca7a 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -1124,8 +1124,9 @@ class Preferences: 'utf32': [ codecs.BOM_UTF32_BE, codecs.BOM_UTF32_LE ] } for encoding in self._getDefaultEncodings(): try: - for m in magic.get(encoding.lower().replace('-', '').replace('_', ''), [ '' ]): - if str(s).startswith(m): + encoding = encoding.lower().replace('-', '').replace('_', '') + for m in magic.get(encoding, [ b'' ]): + if s.startswith(m): break else: continue