From 3dc0b40477fad44d76168e9b1dd96a9cbbfbf660 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Fri, 4 Mar 2011 09:07:12 +0100 Subject: [PATCH] Yield utf-8 encoded strings from DBBinary.scan_contents(). Signed-off-by: Torsten Werner --- daklib/dbconn.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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() -- 2.39.5