[#BloombergLP-bdlde-CharConvertUtf16-utf8ToUtf16-014]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/CharConvertUtf16.adoc[CharConvertUtf16]::utf8ToUtf16
:relfileprefix: ../../../
:mrdocs:

`utf8ToUtf16` overloads

== Synopses

Declared in `&lt;bdlde&lowbar;charconvertutf16&period;h&gt;`

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-06.adoc[utf8ToUtf16](
    xref:bsl/u16string.adoc[bsl::u16string]* dstString,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-06.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0101.adoc[utf8ToUtf16](
    xref:bsl/u16string.adoc[bsl::u16string]* dstString,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0101.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-09.adoc[utf8ToUtf16](
    std::pmr::u16string* dstString,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-09.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0106.adoc[utf8ToUtf16](
    std::pmr::u16string* dstString,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0106.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0e5.adoc[utf8ToUtf16](
    std::u16string* dstString,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0e5.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0dc8.adoc[utf8ToUtf16](
    std::u16string* dstString,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0dc8.adoc[_» more&period;&period;&period;_]#

Convert the UTF&hyphen;8 source to UTF&hyphen;16 in the destination&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-04.adoc[utf8ToUtf16](
    xref:bsl/wstring.adoc[bsl::wstring]* dstString,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-04.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0dca.adoc[utf8ToUtf16](
    xref:bsl/wstring.adoc[bsl::wstring]* dstString,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0dca.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-083.adoc[utf8ToUtf16](
    std::pmr::wstring* dstString,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-083.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0f.adoc[utf8ToUtf16](
    std::pmr::wstring* dstString,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0f.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0e3.adoc[utf8ToUtf16](
    std::wstring* dstString,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0e3.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0b2.adoc[utf8ToUtf16](
    std::wstring* dstString,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0b2.adoc[_» more&period;&period;&period;_]#

Convert the UTF&hyphen;8 source to UTF&hyphen;16 in the destination&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0b9.adoc[utf8ToUtf16](
    xref:bsl/vector-00d.adoc[bsl::vector&lt;unsigned short&gt;]* dstVector,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0b9.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-00.adoc[utf8ToUtf16](
    xref:bsl/vector-00d.adoc[bsl::vector&lt;unsigned short&gt;]* dstVector,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-00.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0cf.adoc[utf8ToUtf16](
    std::pmr::vector&lt;unsigned short&gt;* dstVector,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0cf.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-087.adoc[utf8ToUtf16](
    std::pmr::vector&lt;unsigned short&gt;* dstVector,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-087.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-019.adoc[utf8ToUtf16](
    std::vector&lt;unsigned short&gt;* dstVector,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-019.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-071.adoc[utf8ToUtf16](
    std::vector&lt;unsigned short&gt;* dstVector,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-071.adoc[_» more&period;&period;&period;_]#

Convert the UTF&hyphen;8 source to UTF&hyphen;16 in the destination&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-079.adoc[utf8ToUtf16](
    char16&lowbar;t* dstBuffer,
    std::size&lowbar;t dstCapacity,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    std::size&lowbar;t* numWordsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-079.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-07a.adoc[utf8ToUtf16](
    char16&lowbar;t* dstBuffer,
    std::size&lowbar;t dstCapacity,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    std::size&lowbar;t* numWordsWritten = 0,
    char16&lowbar;t errorChar = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-07a.adoc[_» more&period;&period;&period;_]#

Convert the UTF&hyphen;8 source to UTF&hyphen;16 in the destination&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0ec.adoc[utf8ToUtf16](
    unsigned short* dstBuffer,
    std::size&lowbar;t dstCapacity,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    std::size&lowbar;t* numWordsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0ec.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0c1.adoc[utf8ToUtf16](
    unsigned short* dstBuffer,
    std::size&lowbar;t dstCapacity,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    std::size&lowbar;t* numWordsWritten = 0,
    unsigned short errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0c1.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0e4.adoc[utf8ToUtf16](
    wchar&lowbar;t* dstBuffer,
    std::size&lowbar;t dstCapacity,
    std::string&lowbar;view const& srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    std::size&lowbar;t* numWordsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-0e4.adoc[_» more&period;&period;&period;_]#

Load into the destination the UTF&hyphen;16 conversion of the UTF&hyphen;8 source&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-05.adoc[utf8ToUtf16](
    wchar&lowbar;t* dstBuffer,
    std::size&lowbar;t dstCapacity,
    char const* srcString,
    std::size&lowbar;t* numCodePointsWritten = 0,
    std::size&lowbar;t* numWordsWritten = 0,
    wchar&lowbar;t errorWord = &apos;?&apos;,
    xref:BloombergLP/bdlde/ByteOrder/Enum.adoc[ByteOrder::Enum] byteOrder = ByteOrder&colon;&colon;e&lowbar;HOST);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUtf16/utf8ToUtf16-05.adoc[_» more&period;&period;&period;_]#

== Return Value

* 0 on success and a non&hyphen;zero status otherwise
* 0 on success and `CharConvertStatus&colon;&colon;k&lowbar;INVALID&lowbar;INPUT&lowbar;BIT` otherwise
* 0 on success and a bitwise&hyphen;or of the bits specified by `CharConvertStatus&colon;&colon;Enum` otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *dstString*
| destination for the converted output
| *srcString*
| source string to convert
| *numCodePointsWritten*
| if non&hyphen;null, set to the code&hyphen;point count written
| *errorChar*
| replacement for invalid input, or 0 to skip
| *byteOrder*
| UTF&hyphen;16 byte order&semi; host order if unspecified
| *errorWord*
| replacement for invalid input, or 0 to skip
| *dstVector*
| destination for the converted output
| *dstBuffer*
| destination buffer for the converted output
| *dstCapacity*
| capacity of `dstBuffer` in elements
| *numWordsWritten*
| if non&hyphen;null, set to the word count written
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
