[Reproducible-commits] [debbindiff] 01/03: Fix charset handling of .mo files

Jérémy Bobbio lunar at moszumanska.debian.org
Wed Jun 24 13:29:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository debbindiff.

commit abcbb5dd9083c24dce774e8088928e51e6608d85
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Wed Jun 24 13:26:18 2015 +0000

    Fix charset handling of .mo files
---
 debbindiff/comparators/gettext.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/debbindiff/comparators/gettext.py b/debbindiff/comparators/gettext.py
index 35deb38..8bba053 100644
--- a/debbindiff/comparators/gettext.py
+++ b/debbindiff/comparators/gettext.py
@@ -39,13 +39,14 @@ class Msgunfmt(Command):
 
     def filter(self, line):
         if not self._encoding:
-            if line == '':
+            self._header += line
+            if line == '\n':
                 logger.debug("unable to determine PO encoding, let's hope it's utf-8")
+                self._encoding = 'utf-8'
                 return self._header
-            self._header += line
             found = Msgunfmt.CHARSET_RE.match(line)
             if found:
-                self._encoding = found.group(1)
+                self._encoding = found.group(1).lower()
                 return self._header.decode(self._encoding).encode('utf-8')
             return ''
         if self._encoding != 'utf-8':

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git



More information about the Reproducible-commits mailing list