baudm / mplayer.py

Lightweight Python wrapper for MPlayer
http://pypi.python.org/pypi/mplayer.py
GNU Lesser General Public License v3.0
117 stars 32 forks source link

Unable to play files containing special characters in their names #9

Closed baudm closed 9 years ago

baudm commented 9 years ago

Original issue 6 created by baudm on 2011-07-10T20:01:54.000Z:

What steps will reproduce the problem? python gtk2.py /path/filename/with/special/characters/vidéo.avi

What version of the product are you using? On what operating system? PyMPlayer: last version (e03cdd3f41e9) Python: 2.7.1 OS: Archlinux

Please provide any additional information below. It comes from line 94 in mtypes.py: return MPlayerType.adapt(obj.encode('utf-8', 'ignore'))

For example: >>> obj = u"é" >>> obj.encode('utf-8', 'ignore') '\xc3\xa9' >>> repr(obj.encode('utf-8', 'ignore')) "'\xc3\xa9'"

I replaced this line with: return obj.encode('utf-8', 'ignore').replace(' ', '\ ') It seems to work for paths with special characters and spaces, but I'm not sure it's a good solution.

baudm commented 9 years ago

Comment #1 originally posted by baudm on 2011-07-24T13:29:21.000Z:

I think the call to repr() is screwing this up. In this case, repr() is used for enclosing the string in quotes, which is useful if there are spaces in a path name. However, I didn't expect that it will have a different effect on unicode objects.

I'm thinking of just replacing line 94 with: return "'" + obj.encode('utf-8', 'ignore') + "'"

baudm commented 9 years ago

Comment #2 originally posted by baudm on 2011-08-14T12:17:44.000Z:

This issue was closed by revision 7d2264039281.