[issue9992] Command line arguments are not correctly decodedif locale and fileystem encodings aredifferent

Marc-Andre Lemburg report at bugs.python.org
Thu Sep 30 11:02:05 CEST 2010


Marc-Andre Lemburg <mal at egenix.com> added the comment:

STINNER Victor wrote:
> 
> STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> 
>> The problem with command line arguments is that they don't necessarily
>> have just one encoding (just like env vars may well use more than
>> one encoding) on Unix platforms.
> 
> The issue #8776 proposes the creation of sys.argv.

Right, I think you meant sys.argvb and yes, I think it's a good idea.

>> When using path and file names on the command line they will likely
>> use the file system encoding. When passing in configuration variables,
>> the arguments will likely use the current locale settings.
> 
> Ok, and? We have to pick up one and use it. We cannot guess the encoding of 
> each argument, nor change sys.argv to use bytes. (And the creation sys.argvb 
> will not solve this issue.)

Sure and using the locale setting is fine. The point is that we pick
one, but keep the original data around for the application to use in
case it knows better, so this will solve the problem.

> I still think that using the filesystem encoding is not possible for technical 
> reasons (it might be possible, but it will be very hard), whereas I attached a 
> working patch to use the locale encoding.

----------
title: Command line arguments are not correctly decodedif	locale and fileystem encodings aredifferent -> Command line arguments are not correctly decodedif locale	and fileystem encodings aredifferent

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9992>
_______________________________________


More information about the Python-bugs-list mailing list