[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-17 Thread Peter Bienstman
Peter Bienstman added the comment: > Lars Gustäbel added the comment: > > So, use the pax format. It stores the filenames as utf-8 and this way you > will be on the safe side. > > I hope we both agree that the solution to your particular problem is > nothing tarfile.py can provide. If I wa

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-16 Thread Ezio Melotti
Ezio Melotti added the comment: Lars, I think the situation can still be improved. If tarfile works with bytes strings it should accept only bytes strings or unicode strings that can be encoded in ASCII, and encode them as soon as it gets them. In the problem reported by Peter, he was passing

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-16 Thread Lars Gustäbel
Lars Gustäbel added the comment: So, use the pax format. It stores the filenames as utf-8 and this way you will be on the safe side. I hope we both agree that the solution to your particular problem is nothing tarfile.py can provide. So, I am going to close this issue now. -- resolut

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-15 Thread Peter Bienstman
Peter Bienstman added the comment: On Friday 15 January 2010 02:14:30 pm Lars Gustäbel wrote: > Lars Gustäbel added the comment: > > I suppose you do not have a real problem here. I thought your problem was > that you want to use unicode pathnames as input and output to tarfile. You > don't

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-15 Thread Lars Gustäbel
Lars Gustäbel added the comment: I suppose you do not have a real problem here. I thought your problem was that you want to use unicode pathnames as input and output to tarfile. You don't need that. You want to transfer an archive from one system to another. You can do that with tarfile alre

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-15 Thread Peter Bienstman
Peter Bienstman added the comment: On Friday 15 January 2010 11:51:24 am Lars Gustäbel wrote: > Lars Gustäbel added the comment: > > First, use a string pathname for extractall(). Most likely, your script is > going to work. Convert all pathnames to strings using > sys.getfilesystemencoding(

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-15 Thread Lars Gustäbel
Lars Gustäbel added the comment: First, use a string pathname for extractall(). Most likely, your script is going to work. Convert all pathnames to strings using sys.getfilesystemencoding() before you add() them. Ensure that all systems you are going to use the archives on have the same files

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-15 Thread Peter Bienstman
Peter Bienstman added the comment: So what do suggest then as the best approach if I want to use unicode paths in tar files in Python 2.x in a way that is portable across different systems? -- ___ Python tracker _

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-15 Thread Lars Gustäbel
Lars Gustäbel added the comment: In the 2.x branch tarfile is not prepared to deal with unicode pathnames at all. This changed in Python 3. The fact that it works anyway (in the majority of cases) to add filenames as unicode objects is pure coincidence - I suppose you have a utf-8 system enco

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-13 Thread Ezio Melotti
Ezio Melotti added the comment: When test.tar is opened, the filename is read as a string, so when os.path.join() is called in self._extract_member(tarinfo, os.path.join(path, tarinfo.name)), path is u'.' and tarinfo.name is '\xea\x80\x80a.ogg'. tarinfo.name is a byte string, so in os.path.joi

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-13 Thread Lars Gustäbel
Changes by Lars Gustäbel : -- assignee: -> lars.gustaebel nosy: +lars.gustaebel ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-13 Thread Ezio Melotti
Changes by Ezio Melotti : -- components: +Library (Lib) -Extension Modules nosy: +ezio.melotti priority: -> normal stage: -> test needed type: crash -> behavior versions: +Python 2.7 ___ Python tracker ___

[issue7693] tarfile.extractall can't have unicode extraction path

2010-01-13 Thread Peter Bienstman
New submission from Peter Bienstman : import tarfile fname = unichr(40960) + u"a.ogg" f = file(fname, "w") f.write("A") f.close() tar_pipe = tarfile.open("test.tar", mode="w|", format=tarfile.PAX_FORMAT) tar_pipe.add(fname) tar_pipe.close() tar_pipe = tarfile.open("test.tar") tar_