MCPcopy Create free account
hub / github.com/Snapchat/Valdi / utf8ToUtf16

Function utf8ToUtf16

valdi_core/src/valdi_core/cpp/Text/UTF16Utils.cpp:174–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 out.push_back(0xFFFD);
173 }
174}
175
176std::pair<const char*, size_t> utf16ToUtf8(const char16_t* utf16String, size_t len) {
177 thread_local static std::vector<char> tBuffer;
178 auto& buffer = tBuffer;
179 buffer.clear();
180
181 for (std::u16string::size_type i = 0; i < len;) {
182 utf8Encode(utf16Decode(utf16String, i, len), buffer);
183 }
184
185 return std::make_pair(buffer.data(), buffer.size());
186}
187

Callers 4

utf16StorageMethod · 0.85
utf8ToWStringMethod · 0.85
TESTFunction · 0.85
newStringUTF8Method · 0.85

Calls 5

utf16EncodeFunction · 0.85
utf8DecodeFunction · 0.85
clearMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68