[New-bugs-announce] [issue3023] Problem with invalidly-encoded command-line arguments (Unix)

David Watson report at bugs.python.org
Mon Jun 2 00:22:17 CEST 2008

New submission from David Watson <baikie at users.sourceforge.net>:

The error message has no newline at the end:

$ LANG=en_GB.UTF-8 python3.0 test.py $'\xff'
Could not convert argument 2 to string$

Seriously, though: is this the intended behaviour?  If the
interpreter just dies when it gets a non-UTF-8 (or whatever)
argument, it creates an opportunity for a denial-of-service if
some admin is running a Python script via find(1) or similar.
And what if you want to run a Python script on some files named
in a mixture of charsets (because, say, you just untarred an
archive created in a foreign charset)?

Could sys.argv not provide bytes objects for those arguments,
like os.listdir()?  Or (better IMHO) have a separate
sys.argv_bytes interface?

components: Unicode
messages: 67608
nosy: baikie
severity: normal
status: open
title: Problem with invalidly-encoded command-line arguments (Unix)
type: behavior
versions: Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list