convert UNICODE string aka UTF16 string to multi byte string aka UTF8 string
| 17 | // convert UNICODE string aka UTF16 string |
| 18 | // to multi byte string aka UTF8 string |
| 19 | void UTF16toMBS(const wchar_t *u, size_t srclen, char *mbs, size_t dstlen) |
| 20 | { |
| 21 | #ifdef _WIN32 |
| 22 | WideCharToMultiByte(CP_ACP, 0, u, srclen / 2, mbs, dstlen, nullptr, nullptr); |
| 23 | #else |
| 24 | iconv_t conv = iconv_open("UTF-8", "UTF-16"); |
| 25 | if (iconv(conv, (char **)&u, &srclen, &mbs, &dstlen) == (size_t) - 1) |
| 26 | { |
| 27 | perror("iconv"); |
| 28 | } |
| 29 | iconv_close(conv); |
| 30 | #endif // _WIN32 |
| 31 | } |
| 32 | |
| 33 | |
| 34 | void PrintFileName(const char *name) |
no outgoing calls
no test coverage detected