1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-20 02:03:15 +00:00

1. Added support for UTF8 wnvironment variables for window's child_process

2. Updated message-box and toaster to support UTF8 on Windows
This commit is contained in:
Bryan Roe
2020-06-09 19:37:37 -07:00
parent 946bbd5cb9
commit 10a9e7226e
5 changed files with 45 additions and 12 deletions

View File

@@ -173,10 +173,15 @@ static inline void ignore_result(uintptr_t result) { (void)result; }
#ifdef WIN32
char *ILibWideToUTF8Ex(WCHAR* wstr, int wstrCharacterLen, char *buffer, int bufferLen);
#define ILibWideToUTF8(wstr, wstrCharacterLen) ILibWideToUTF8Ex(wstr, wstrCharacterLen, NULL, 0)
char *ILibWideToUTF8_stupidEx(WCHAR* wstr, int wstrBYTESIZE, char *buffer, int bufferLen);
#define ILibWideToUTF8_stupid(wstr, wstrBYTESIZE) ILibWideToUTF8_stupidEx(wstr, wstrBYTESIZE, NULL, 0)
WCHAR* ILibUTF8ToWideEx(char* str, int len, WCHAR* buffer, int bufferCharacterSize);
#define ILibUTF8ToWide(utf8string, len) ILibUTF8ToWideEx(utf8string, len, NULL, 0)
#define ILibUTF8ToWideCount(utf8string) MultiByteToWideChar(CP_UTF8, 0, (LPCCH)utf8string, -1, NULL, 0)
#define ILibUTF8ToWideCountEx(utf8string, outBuffer, outBufferLen) MultiByteToWideChar(CP_UTF8, 0, (LPCCH)utf8string, -1, outBuffer, outBufferLen)
// The following two methods are for the special case, when only the bytes count is known, not the character count.
char *ILibWideToUTF8_stupidEx(WCHAR* wstr, int wstrBYTESIZE, char *buffer, int bufferLen);
#define ILibWideToUTF8_stupid(wstr, wstrBYTESIZE) ILibWideToUTF8_stupidEx(wstr, wstrBYTESIZE, NULL, 0)
#else
#define ILibWideToUTF8(wstr, len) (wstr)
#define ILibWideToUTF8Ex(wstr, len, buffer, sz) (wstr)