m4myo / python-mplayer

Automatically exported from code.google.com/p/python-mplayer
GNU Lesser General Public License v3.0
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by lucas.se...@gmail.com on 10 Jul 2011 at 8:01

GoogleCodeExporter commented 9 years ago
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') + "'"

Original comment by daru...@gmail.com on 24 Jul 2011 at 1:29

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 7d2264039281.

Original comment by daru...@gmail.com on 14 Aug 2011 at 12:17