What encoding is used when initializing sys.argv?

Petr Prikryl PrikrylP at skil.cz
Thu Oct 6 08:39:21 CEST 2005


Thanks, Martin v. Löwis, Neil Hodgson, and Tim Roberts.
I really appreciate your valuable comments. It simply
works.

Thanks again,
  Petr

"Neil Hodgson" wrote...
> Petr Prikryl:
> 
> > I do not understand what encoding should be used
> > to convert the sys.argv into unicode.
> 
> Martin mentioned CP_ACP. In Python on Windows, this 
> can be accessed as the "mbcs" codec.
> 
> import sys
> print repr(sys.argv[1])
> print repr(unicode(sys.argv[1], "mbcs"))
> 
> C:\bin>python glurp.py abcß*
> 'abc\xdf\x95'
> u'abc\xdf\u2022'
> 
>     Neil



More information about the Python-list mailing list