X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=04823061814912e5da33d084acaeb5cc1ecdf45f;hb=cd33ae05e818e0b6161ef4c1a9eb368cae6db5f4;hp=aab025136f0b35139f6f1ef590d52b11ea921cb8;hpb=759d4478ec33ec1721d1eb24b1de4e8b5b56dd5d;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index aab02513..04823061 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -508,18 +508,22 @@ class DBBinary(ORMObject): def scan_contents(self): ''' Yields the contents of the package. Only regular files are yielded and - the path names are normalized after converting them from iso8859-1 - encoding. + the path names are normalized after converting them from either utf-8 or + iso8859-1 encoding. ''' fullpath = self.poolfile.fullpath - debdata = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], - stdout = PIPE).stdout - tar = TarFile.open(fileobj = debdata, mode = 'r|') + dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE) + tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|') for member in tar.getmembers(): if member.isfile(): - yield normpath(member.name.decode('iso8859-1')) + try: + name = member.name.decode('utf-8') + except UnicodeDecodeError: + name = member.name.decode('iso8859-1') + yield normpath(name) tar.close() - debdata.close() + dpkg.stdout.close() + dpkg.wait() __all__.append('DBBinary')