From: Torsten Werner Date: Fri, 4 Mar 2011 08:07:12 +0000 (+0100) Subject: Yield utf-8 encoded strings from DBBinary.scan_contents(). X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dc0b40477fad44d76168e9b1dd96a9cbbfbf660;p=dak Yield utf-8 encoded strings from DBBinary.scan_contents(). Signed-off-by: Torsten Werner --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 5bff4186..87db1a35 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -516,11 +516,13 @@ class DBBinary(ORMObject): tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|') for member in tar.getmembers(): if member.isfile(): + name = normpath(member.name) + # enforce proper utf-8 encoding try: - name = member.name.decode('utf-8') + name.decode('utf-8') except UnicodeDecodeError: - name = member.name.decode('iso8859-1') - yield normpath(name) + name = name.decode('iso8859-1').encode('utf-8') + yield name tar.close() dpkg.stdout.close() dpkg.wait()