Opened 7 years ago

Last modified 7 years ago

#2325 open defect

MPlayer doesn't auto load subtitles with unicode filenames

Reported by: redxii Owned by: beastd
Priority: normal Component: undetermined
Version: HEAD Severity: minor
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: yes Analyzed by developer: yes

Description

Currently MPlayer has no problem opening files with unicode names but it is unable to autoload subtitles if they have unicode names.

For example, when opening "アニメ.avi" won't be able to find & auto load "アニメ.srt".

Attachments (1)

0001-HACK-sub-Partially-support-non-ASCII-external-subs-o.patch (1.0 KB ) - added by beastd 7 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by redxii, 7 years ago

Forgot, OS is Windows 7 & Windows 10.

comment:2 by beastd, 7 years ago

Reproduced by developer: set
Status: newopen

Thank you for the report.

I can reproduce it here on Windows 10. Did not look into it yet.

comment:3 by beastd, 7 years ago

I had a deeper look into this problem, but didn't find a fix yet.

It seems the local codepage encoded name used as a reference to find the subtitle gets re-coded somewhere. Thus it won't match the name in subreader.c anymore.

comment:4 by beastd, 7 years ago

Analyzed by developer: set

I attached a patch 0001-HACK-sub-Partially-support-non-ASCII-external-subs-o.patch that does help a bit with this on Windows. It is a just a quick hack and breaks the build for other platforms as is.

The real problem with this is, that it will only help with file names that can be represented in your local windows code page. Thus if your local code page, does not support the Japanese characters of your example, this patch will not help you.

Implementing a better solution is much more involved. I will describe why the thing does not work with the current code:

  1. in subreader.c : append_dir_subtitles readdir will return the name in the local code page
  2. the name we match to, is deduced from the movie name and is in UTF-8 already
  3. after we matched the name, we try to fopen the file (to test it is readable?)
  4. then, when it is time to read the file, we would actually need the UTF-8 version of the matching filename

Currently we will fail at 2 because of the encoding mismatch.

So basically 2 and 3 need to be addressed; though I think 3 cannot work as long as we use fopen (because I think it does not support names outside of the local code page).

Note: See TracTickets for help on using tickets.