Re: sys.argv as a list of bytes

2012-01-19 Thread jmfauth
> > In short: if you need to write "system" scripts on Unix, and you need them > to work reliably, you need to stick with Python 2.x. I think, understanding the coding of the characters helps a bit. I can not figure out how the example below could not be done on other systems. D:\tmp>chcp Page

Re: sys.argv as a list of bytes

2012-01-18 Thread Nobody
On Wed, 18 Jan 2012 09:05:42 +0100, Peter Otten wrote: >> Python has a special errorhandler, "surrogateescape" to deal with >> bytes that are not valid UTF-8. On Wed, 18 Jan 2012 11:16:27 +0100, Olive wrote: > But is it safe even if the locale is not UTF-8? Yes. Peter's reference to UTF-8 is mi

Re: sys.argv as a list of bytes

2012-01-18 Thread Peter Otten
Olive wrote: > On Wed, 18 Jan 2012 09:05:42 +0100 > Peter Otten <__pete...@web.de> wrote: > >> Olive wrote: >> >> > In Unix the operating system pass argument as a list of C strings. >> > But C strings does corresponds to the bytes notions of Pytho

Re: sys.argv as a list of bytes

2012-01-18 Thread Olive
On Wed, 18 Jan 2012 09:05:42 +0100 Peter Otten <__pete...@web.de> wrote: > Olive wrote: > > > In Unix the operating system pass argument as a list of C strings. > > But C strings does corresponds to the bytes notions of Python3. Is > > it possible to have sys.

Re: sys.argv as a list of bytes

2012-01-18 Thread Peter Otten
Olive wrote: > In Unix the operating system pass argument as a list of C strings. But > C strings does corresponds to the bytes notions of Python3. Is it > possible to have sys.argv as a list of bytes ? What happens if I pass > to a program an argumpent containing funny "charac

sys.argv as a list of bytes

2012-01-17 Thread Olive
In Unix the operating system pass argument as a list of C strings. But C strings does corresponds to the bytes notions of Python3. Is it possible to have sys.argv as a list of bytes ? What happens if I pass to a program an argumpent containing funny "character", for example (with a