-# -*- coding: iso-8859-15 -*-
-
import sys
import os
import io
self._test_member(tarinfo, size=86016, chksum=md5_sparse)
def test_find_umlauts(self):
- tarinfo = self.tar.getmember("ustar/umlauts-ÄÖÜäöüß")
+ tarinfo = self.tar.getmember("ustar/umlauts-\xc4\xd6\xdc\xe4\xf6\xfc\xdf")
self._test_member(tarinfo, size=7011, chksum=md5_regtype)
def test_find_ustar_longname(self):
def test_find_pax_umlauts(self):
self.tar = tarfile.open(self.tarname, mode=self.mode, encoding="iso8859-1")
- tarinfo = self.tar.getmember("pax/umlauts-ÄÖÜäöüß")
+ tarinfo = self.tar.getmember("pax/umlauts-\xc4\xd6\xdc\xe4\xf6\xfc\xdf")
self._test_member(tarinfo, size=7011, chksum=md5_regtype)
tarinfo = tar.getmember("pax/regtype1")
self.assertEqual(tarinfo.uname, "foo")
self.assertEqual(tarinfo.gname, "bar")
- self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "ÄÖÜäöüß")
+ self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "\xc4\xd6\xdc\xe4\xf6\xfc\xdf")
tarinfo = tar.getmember("pax/regtype2")
self.assertEqual(tarinfo.uname, "")
self.assertEqual(tarinfo.gname, "bar")
- self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "ÄÖÜäöüß")
+ self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "\xc4\xd6\xdc\xe4\xf6\xfc\xdf")
tarinfo = tar.getmember("pax/regtype3")
self.assertEqual(tarinfo.uname, "tarfile")
self.assertEqual(tarinfo.gname, "tarfile")
- self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "ÄÖÜäöüß")
+ self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "\xc4\xd6\xdc\xe4\xf6\xfc\xdf")
def test_pax_number_fields(self):
# All following number fields are read from the pax header.
"foo": "bar",
"uid": "0",
"mtime": "1.23",
- "test": "äöü",
- "äöü": "test"}
+ "test": "\xe4\xf6\xfc",
+ "\xe4\xf6\xfc": "test"}
tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \
pax_headers=pax_headers)
tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="iso8859-1")
t = tarfile.TarInfo()
- t.name = "äöü" # non-ASCII
+ t.name = "\xe4\xf6\xfc" # non-ASCII
t.uid = 8**8 # too large
t.pax_headers = pax_headers
tar.addfile(t)
def _test_unicode_filename(self, encoding):
tar = tarfile.open(tmpname, "w", format=self.format, encoding=encoding, errors="strict")
- name = "äöü"
+ name = "\xe4\xf6\xfc"
tar.addfile(tarfile.TarInfo(name))
tar.close()
tar = tarfile.open(tmpname, "w", format=self.format, encoding="ascii", errors="strict")
tarinfo = tarfile.TarInfo()
- tarinfo.name = "äöü"
+ tarinfo.name = "\xe4\xf6\xfc"
self.assertRaises(UnicodeError, tar.addfile, tarinfo)
tarinfo.name = "foo"
- tarinfo.uname = "äöü"
+ tarinfo.uname = "\xe4\xf6\xfc"
self.assertRaises(UnicodeError, tar.addfile, tarinfo)
def test_unicode_argument(self):
tar.close()
def test_uname_unicode(self):
- for name in ("äöü", "äöü"):
+ for name in ("\xe4\xf6\xfc", "\xe4\xf6\xfc"):
t = tarfile.TarInfo("foo")
t.uname = name
t.gname = name
tar = tarfile.open("foo.tar", fileobj=fobj, encoding="iso8859-1")
t = tar.getmember("foo")
- self.assertEqual(t.uname, "äöü")
- self.assertEqual(t.gname, "äöü")
+ self.assertEqual(t.uname, "\xe4\xf6\xfc")
+ self.assertEqual(t.gname, "\xe4\xf6\xfc")
class GNUUnicodeTest(UstarUnicodeTest):