Unicode filename to python subprocess.call()

Posted by otrov on Stack Overflow See other posts from Stack Overflow or by otrov
Published on 2010-04-07T19:53:07Z Indexed on 2010/04/07 20:03 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

I'm trying to run subprocess.call() with unicode filename, and here is simplified problem:

n = u'c:\\windows\\notepad.exe '
f = u'c:\\temp\\nèw.txt'

subprocess.call(n + f)

which raises famous error:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8'

Encoding to utf-8 produces wrong filename, and mbcs passes filename as new.txt without accent

I just can't read any more on this confusing subject and spin in circle. I found here lot of answers for many different problems in past so I thought to join and ask for help myself

Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about unicode