MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / utf16_utf8

Method utf16_utf8

src/helper.cpp:710–717  ·  view source on GitHub ↗

Converts High- and Low-Surrogate to UTF-8 code units, stored in a std::string

Source from the content-addressed store, hash-verified

708
709// Converts High- and Low-Surrogate to UTF-8 code units, stored in a std::string
710std::string Helper::utf16_utf8(uint16_t high, uint16_t low) {
711 if( high <= 0xD7FF || high >= 0xE000) {
712 // just a BMP code point
713 return encodeUtf8(high);
714 }
715 uint32_t cp = (high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000; // TODO * 0x400 => >> 10
716 return encodeUtf8(cp);
717}
718
719
720

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected