MCPcopy Create free account
hub / github.com/citron-neo/emulator / CPToUTF16

Function CPToUTF16

src/common/string_util.cpp:203–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201
202#ifdef _WIN32
203static std::wstring CPToUTF16(u32 code_page, std::string_view input) {
204 const auto size =
205 MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()), nullptr, 0);
206
207 if (size == 0) {
208 return {};
209 }
210
211 std::wstring output(size, L'\0');
212
213 if (size != MultiByteToWideChar(code_page, 0, input.data(), static_cast<int>(input.size()),
214 &output[0], static_cast<int>(output.size()))) {
215 output.clear();
216 }
217
218 return output;
219}
220
221std::string UTF16ToUTF8(std::wstring_view input) {
222 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