MCPcopy Create free account
hub / github.com/JayXon/Leanify / UTF16toMBS

Function UTF16toMBS

utils.cpp:19–31  ·  view source on GitHub ↗

convert UNICODE string aka UTF16 string to multi byte string aka UTF8 string

Source from the content-addressed store, hash-verified

17// convert UNICODE string aka UTF16 string
18// to multi byte string aka UTF8 string
19void 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
34void PrintFileName(const char *name)

Callers 2

LeanifyMethod · 0.85
TraverseRSRCMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected