@@ -110,7 +110,7 @@ def tar_stream(store, tree, mtime, prefix=b"", format=""):
info = tarfile.TarInfo()
# tarfile only works with ascii.
- info.name = entry_abspath.decode("ascii")
+ info.name = entry_abspath.decode('utf-8', 'surrogateescape')
info.size = blob.raw_length()
info.mode = entry.mode
info.mtime = mtime
@@ -81,8 +81,7 @@ class ArchiveTests(TestCase):
t1.add("ő".encode('utf-8'), 0o100644, b1.id)
store.add_object(t1)
stream = b"".join(tar_stream(store, t1, mtime=0))
- BytesIO(stream)
- tf = tarfile.TarFile(fileobj=stream)
+ tf = tarfile.TarFile(fileobj=BytesIO(stream))
self.addCleanup(tf.close)
self.assertEqual(["ő"], tf.getnames())