[#BloombergLP-bdlde-CharConvertUtf16-utf8ToUtf16-04] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/CharConvertUtf16.adoc[CharConvertUtf16]::utf8ToUtf16 :relfileprefix: ../../../ :mrdocs: that UTF‐16 can validly encode (in the range `[ 1 .. 0xd7ff ]` or `[ 0xe000 .. 0x10ffff ]`). If `errorChar` is 0, invalid input code points are ignored (i.e., produce no corresponding output). The behavior is undefined unless `srcString` is null‐terminated when specified as a `const char *`. Note that one code point can occupy multiple UTF‐16 words, and that if `srcString` is a `bslstl::StringRef`, it may contain embedded null bytes that will be translated to null words embedded in the output. == Synopsis Declared in `<bdlde_charconvertutf16.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int utf8ToUtf16( xref:bsl/wstring.adoc[bsl::wstring]* dstString, std::string_view const& srcString, std::size_t* numCodePointsWritten = 0, wchar_t errorWord = '?', xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder::e_HOST); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#