| 5 | |
| 6 | #ifdef _WIN32 |
| 7 | LPCWSTR StringUTF8ToWChar(LPCSTR sUTF8, CStringW &sWChar, int iChars/* = -1*/) |
| 8 | { |
| 9 | if (!sUTF8) |
| 10 | return NULL; |
| 11 | |
| 12 | sWChar.Empty(); |
| 13 | int iLen = MultiByteToWideChar(CP_UTF8, 0, sUTF8, iChars, NULL, 0); |
| 14 | if (iLen > 0) { |
| 15 | LPWSTR sBuf = sWChar.GetBufferSetLength(iLen); |
| 16 | iLen = MultiByteToWideChar(CP_UTF8, 0, sUTF8, iChars, sBuf, iLen); |
| 17 | sWChar.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1); |
| 18 | return (iLen > 0) ? sWChar.GetString() : NULL; |
| 19 | } |
| 20 | |
| 21 | return *sUTF8 != 0 ? sWChar.GetString() : NULL; |
| 22 | } |
| 23 | |
| 24 | LPCWSTR StringCharToWChar(LPCSTR sChar, CStringW &sWChar, int iChars/* = -1*/, UINT codepage/* = CP_ACP*/) |
| 25 | { |
no test coverage detected