In <[EMAIL PROTECTED]>, Jiba wrote:

> I am desperately searching for the encoding of sys.argv.
>
> I use a Linux box, with French UTF-8 locales and an UTF-8 filesystem.
> sys.getdefaultencoding() is "ascii" and sys.getfilesystemencoding() is
> "utf-8". However, sys.argv is neither in ASCII (since I can pass French
> accentuated character), nor in UTF-8. It seems to be encoded in
> "latin-1", but why ?

There is no way to determine the encoding.  The application that starts
another and sets the arguments can use any encoding it likes and there's
no standard way to find out which it was.

The `sys.stdin.encoding` approach isn't very robust because this will only
be set if the interpreter can find out what encoding is used on `stdin`. 
That's impossible if the `stdin` is the input from another file.

Make it explicit: Add a command line option to choose the encoding.

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to