Commit f85d7f60 authored by François Grisez's avatar François Grisez

MKV: Convert paths from UTF-8 to ACP before passing them to StreamOpen()

parent cbdcaacb
......@@ -902,9 +902,23 @@ static ms_bool_t matroska_load_file(Matroska *obj) {
return TRUE;
}
static int matroska_open_file(Matroska *obj, const char path[], MatroskaOpenMode mode) {
static int matroska_open_file(Matroska *obj, const char *path, MatroskaOpenMode mode) {
int err = 0;
#ifdef _MSC_VER
wchar_t wpath[MAX_PATH + 1];
char mbpath[MAX_PATH + 1];
if (MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, MAX_PATH + 1) == 0) {
ms_error("Could not convert %s into UTF-16", path);
return -1;
}
if (WideCharToMultiByte(CP_ACP, 0, wpath, -1, mbpath, MAX_PATH + 1, NULL, NULL) == 0) {
ms_error("Could not convert %s from UTF-16 to ACP", path);
return -1;
}
path = mbpath;
#endif
switch(mode) {
case MKV_OPEN_CREATE:
if((obj->output = StreamOpen(obj->p, path, SFLAG_WRONLY | SFLAG_CREATE)) == NULL) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment