MCPcopy Create free account
hub / github.com/amwatson/CitraVR / CPToUTF16

Function CPToUTF16

src/common/string_util.cpp:168–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166
167#ifdef _WIN32
168static std::wstring CPToUTF16(u32 code_page, const std::string& input) {
169 const auto size =
170 MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()), nullptr, 0);
171
172 if (size == 0) {
173 return {};
174 }
175
176 std::wstring output(size, L'\0');
177
178 if (size != MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()),
179 &output[0], static_cast<int>(output.size()))) {
180 output.clear();
181 }
182
183 return output;
184}
185
186std::string UTF16ToUTF8(const std::wstring& input) {
187 const auto size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast<int>(input.size()),

Callers 1

UTF8ToUTF16WFunction · 0.85

Calls 3

dataMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected