[Reproducible-commits] [debbindiff] 01/05: attempt at fixing unicode issues with --text

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 a8ad371e777802f620bf8f5055ad0437cec9d5b0
Author: Helmut Grohne <helmut at subdivi.de>
Date:   Thu Mar 26 08:10:07 2015 +0100

    attempt at fixing unicode issues with --text
    
    Make print_func accept unicode objects by opening the output using the
    codecs module. This affects --html output.
    
    Closes: #778641
---
 debbindiff.py                 | 3 ++-
 debbindiff/presenters/text.py | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debbindiff.py b/debbindiff.py
index a4141bd..b363629 100755
--- a/debbindiff.py
+++ b/debbindiff.py
@@ -23,6 +23,7 @@ from __future__ import print_function
 import argparse
 from contextlib import contextmanager
 import logging
+import codecs
 import os
 import sys
 import traceback
@@ -61,7 +62,7 @@ def make_printer(path):
     if path == '-':
         output = sys.stdout
     else:
-        output = open(path, 'w')
+        output = codecs.open(path, 'w', encoding='utf-8')
     def print_func(*args, **kwargs):
         kwargs['file'] = output
         print(*args, **kwargs)
diff --git a/debbindiff/presenters/text.py b/debbindiff/presenters/text.py
index c7197a3..3468978 100644
--- a/debbindiff/presenters/text.py
+++ b/debbindiff/presenters/text.py
@@ -43,7 +43,7 @@ def print_difference(difference, print_func):
         for line in g:
             if line.startswith('--- ') or line.startswith('+++ '):
                 continue
-            print_func("│ %s" % line.encode(locale.getpreferredencoding()), end='')
+            print_func(u"│ %s" % line, end='')
 
 def print_details(difference, print_func):
     if not difference.details:

-- 
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