Commit e6295d45 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: ToWide() converts UTF-8 to UTF-16

parent 726e4ea7
...@@ -54,10 +54,24 @@ static inline char *FromWide (const wchar_t *wide) ...@@ -54,10 +54,24 @@ static inline char *FromWide (const wchar_t *wide)
char *out = (char *)malloc (len); char *out = (char *)malloc (len);
if (out) if (likely(out))
WideCharToMultiByte (CP_UTF8, 0, wide, -1, out, len, NULL, NULL); WideCharToMultiByte (CP_UTF8, 0, wide, -1, out, len, NULL, NULL);
return out; return out;
} }
LIBVLC_USED
static inline wchar_t *ToWide (const char *utf8)
{
int len = MultiByteToWideChar (CP_UTF8, 0, utf8, -1, NULL, 0);
if (len == 0)
return NULL;
wchar_t *out = (wchar_t *)malloc (len * sizeof (wchar_t));
if (likely(out))
MultiByteToWideChar (CP_UTF8, 0, utf8, -1, out, len);
return out;
}
#endif #endif
/** /**
......
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