From 5d1c76647c795f485288fe91f3f365c66b854034 Mon Sep 17 00:00:00 2001
From: Alexander Strasser <eclipse7@gmx.net>
Date: Sun, 7 May 2017 23:03:56 +0200
Subject: [PATCH] HACK: sub: Partially support non-ASCII external subs on
 Windows

* Will only work for external subtitle file names in your local code page
* Works only with the one-liner because stream_file on windows falls back
  to _sopen (otherwise we would have to re-code the directory entry's name)
---
 sub/subreader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sub/subreader.c b/sub/subreader.c
index d57856b..a3f8fbe 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -1990,7 +1990,7 @@ static void append_dir_subtitles(struct sub_list *slist, const char *path,
     len = (strlen(fname) > 256 ? strlen(fname) : 256)
          + (strlen(path) > 256 ? strlen(path) : 256) + 2;
 
-    f_fname       = strdup(mp_basename(fname));
+    f_fname       = utf8_to_local_windows_code_page(mp_basename(fname));
     f_fname_noext = malloc(len);
     f_fname_trim  = malloc(len);
 
-- 
2.8.2

