decode command line parameters - recomendend way

Jax 77jacek at wp.pl
Thu Apr 30 11:02:56 EDT 2009


Hello

I want add full Unicode support in my scripts. Now I have encoutered theoretical
problem with command line parameters. I can't find anything in that mater. But
I develop solution which seems to work. Question is: Is it recommendend way to
decode command line parameters:

lFileConfig = None
if len(sys.argv) > 1:
   lFileConfig = unicode(sys.argv[1], locale.getpreferredencoding())

Or maybe there is other solution?

Jax

ps:
$ python --version
Python 2.5.2




More information about the Python-list mailing list