Problem in accessing files with unicode fonts.

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Feb 24 04:45:35 EST 2009


En Tue, 24 Feb 2009 07:18:41 -0200, venutaurus539 at gmail.com  
<venutaurus539 at gmail.com> escribió:

> Thank you for your solution. It really helped. But how should I give
> if my path is in a varialble.
>
> For ex: path has that value obtained through command line arguments.
>
> path = sys.argv[2]
>
> In such a case how can we convert the path to UNICODE?

If you know the encoding used for your file names, use it; else try  
sys.getfilesystemencoding()

fsencoding = sys.getfilesystemencoding()
path = sys.argv[2].decode(fsencoding)

-- 
Gabriel Genellina




More information about the Python-list mailing list