[Reproducible-commits] [debbindiff] 02/05: Try with utf-8 encoding when comparing text files
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Mar 27 17:49:54 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to annotated tag 12
in repository debbindiff.
commit 383b4e8f68e2618fa5e32a2d8923604956393daa
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Mar 27 18:28:29 2015 +0100
Try with utf-8 encoding when comparing text files
If different encodings are detected, compare_text_files will be given
encoding=None. Let's try to decode stuff as utf-8 as a best guess.
We'll fallback on binary comparison if that doesn't work out well.
---
debbindiff/comparators/text.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/debbindiff/comparators/text.py b/debbindiff/comparators/text.py
index 3cb2bab..1583ce1 100644
--- a/debbindiff/comparators/text.py
+++ b/debbindiff/comparators/text.py
@@ -23,6 +23,8 @@ from debbindiff.difference import Difference
def compare_text_files(path1, path2, encoding, source=None):
+ if encoding is None:
+ encoding = 'utf-8'
try:
lines1 = codecs.open(path1, 'r', encoding=encoding).readlines()
lines2 = codecs.open(path2, 'r', encoding=encoding).readlines()
--
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