Closed baudm closed 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') + "'"
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.