diff options
Diffstat (limited to 'src/m_misc.c')
-rw-r--r-- | src/m_misc.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/m_misc.c b/src/m_misc.c index e14436a3..47aea8b9 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -32,9 +32,9 @@ #include <ctype.h> #include <errno.h> -// for mkdir: - #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> #include <io.h> #ifdef _MSC_VER #include <direct.h> @@ -296,3 +296,22 @@ char *M_StrCaseStr(char *haystack, char *needle) return NULL; } +#ifdef _WIN32 + +char *M_OEMToUTF8(const char *oem) +{ + unsigned int len = strlen(oem) + 1; + wchar_t *tmp; + char *result; + + tmp = malloc(len * sizeof(wchar_t)); + MultiByteToWideChar(CP_OEMCP, 0, oem, len, tmp, len); + result = malloc(len * 4); + WideCharToMultiByte(CP_UTF8, 0, tmp, len, result, len * 4, NULL, NULL); + free(tmp); + + return result; +} + +#endif + |