提交 fa2816b8 编写于 作者: T Torsten Werner

Support utf-8 encoding as a primary encoding for filenames.

Signed-off-by: NTorsten Werner <twerner@debian.org>
上级 759d4478
......@@ -508,8 +508,8 @@ 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],
......@@ -517,7 +517,11 @@ class DBBinary(ORMObject):
tar = TarFile.open(fileobj = debdata, mode = 'r|')
for member in tar.getmembers():
if member.isfile():
yield normpath(member.name.decode('iso8859-1'))
try:
name = member.name.decode('utf-8')
catch UnicodeDecodeError:
name = member.name.decode('iso8859-1')
yield normpath(name)
tar.close()
debdata.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册