Marc 'BlackJack' Rintsch wrote:
> 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.

There is standard way: nl_langinfo function
<http://www.opengroup.org/onlinepubs/009695399/functions/nl_langinfo.html>
The code in pythonrun.c properly uses it find out the encoding. The
other question if Linux or *BSD distributions confirm to the standard.

  -- Leo.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to