decode command line parameters - recomendend way

Jax 77jacek at
Thu Apr 30 17:02:56 CEST 2009


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?


$ python --version
Python 2.5.2

More information about the Python-list mailing list