MCPcopy Create free account
hub / github.com/VCVRack/Rack / UTF16toUTF8

Function UTF16toUTF8

src/string.cpp:545–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543
544#if defined ARCH_WIN
545std::string UTF16toUTF8(const std::wstring& w) {
546 if (w.empty())
547 return "";
548 // Compute length of output buffer
549 int len = WideCharToMultiByte(CP_UTF8, 0, &w[0], w.size(), NULL, 0, NULL, NULL);
550 assert(len > 0);
551 std::string s;
552 // Allocate enough space for null character
553 s.resize(len);
554 len = WideCharToMultiByte(CP_UTF8, 0, &w[0], w.size(), &s[0], len, 0, 0);
555 assert(len > 0);
556 return s;
557}
558
559
560std::wstring UTF8toUTF16(const std::string& s) {

Callers 4

wmainFunction · 0.85
initSystemDirFunction · 0.85
initUserDirFunction · 0.85
archiveDirectoryFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected