MCPcopy Create free account
hub / github.com/aseprite/laf / to_utf8

Function to_utf8

base/string.cpp:146–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144#ifdef LAF_WINDOWS
145
146std::string to_utf8(const wchar_t* src, const size_t n)
147{
148 int required_size = ::WideCharToMultiByte(CP_UTF8, 0, src, (int)n, NULL, 0, NULL, NULL);
149
150 if (required_size == 0)
151 return std::string();
152
153 std::vector<char> buf(++required_size);
154
155 ::WideCharToMultiByte(CP_UTF8, 0, src, (int)n, &buf[0], required_size, NULL, NULL);
156
157 return std::string(&buf[0]);
158}
159
160std::wstring from_utf8(const std::string& src)
161{

Callers 2

string_to_lowerFunction · 0.70
string_to_upperFunction · 0.70

Calls 1

insert_utf8_charFunction · 0.85

Tested by

no test coverage detected