[#BloombergLP-bdlde-CharConvertUcs2-utf8ToUcs2-0dd]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/CharConvertUcs2.adoc[CharConvertUcs2]::utf8ToUcs2
:relfileprefix: ../../../
:mrdocs:

`utf8ToUcs2` overloads

== Synopses

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

Load into `result` the UCS&hyphen;2 conversion of the null&hyphen;terminated UTF&hyphen;8 `srcString`&period; Return 0 on success and a non&hyphen;zero status otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUcs2/utf8ToUcs2-06.adoc[utf8ToUcs2](
    xref:bsl/vector-00d.adoc[bsl::vector&lt;unsigned short&gt;]* result,
    char const* srcString,
    unsigned short errorCharacter = &apos;?&apos;);
----

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

Load into `result` the UCS&hyphen;2 conversion of the null&hyphen;terminated UTF&hyphen;8 `srcString`&period; Return 0 on success and a non&hyphen;zero status otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUcs2/utf8ToUcs2-04.adoc[utf8ToUcs2](
    std::pmr::vector&lt;unsigned short&gt;* result,
    char const* srcString,
    unsigned short errorCharacter = &apos;?&apos;);
----

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

Load into `result` the UCS&hyphen;2 conversion of the null&hyphen;terminated UTF&hyphen;8 `srcString`&period; Return 0 on success and a non&hyphen;zero status otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUcs2/utf8ToUcs2-09.adoc[utf8ToUcs2](
    std::vector&lt;unsigned short&gt;* result,
    char const* srcString,
    unsigned short errorCharacter = &apos;?&apos;);
----

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

Load, into the specified `dstBuffer` of the specified `dstCapacity`, the result of converting the specified null&hyphen;terminated UTF&hyphen;8 `srcString` to its UCS&hyphen;2 equivalent&period; Optionally specify `numCharsWritten` which (if non&hyphen;zero) indicates the modifiable integer into which the number of characters written (including the null terminator) is to be loaded&period; Optionally specify `errorCharacter` to be substituted for invalid (i&period;e&period;, not convertible to UCS&hyphen;2) input characters&period; If `errorCharacter` is 0, invalid input characters are ignored (i&period;e&period;, produce no corresponding output characters)&period; Return 0 on success and a bitwise&hyphen;or of the masks specified by `CharConvertStatus&colon;&colon;Enum` otherwise, with `CharConvertStatus&colon;&colon;k&lowbar;INVALID&lowbar;INPUT&lowbar;BIT` set to indicate that at least one invalid input sequence was encountered, and `CharConvertStatus&colon;&colon;k&lowbar;OUT&lowbar;OF&lowbar;SPACE&lowbar;BIT` set to indicate that `dstCapacity` was insufficient to accommodate the output&period; If `dstCapacity` was insufficient, the maximal null&hyphen;terminated prefix of the properly converted result string is loaded into `dstBuffer`, and (unless null) `&ast;numCharsWritten` is set to `dstCapacity`&period; The behavior is undefined unless `0 &lt;&equals; dstCapacity`, `dstBuffer` refers to an array of at least `dstCapacity` elements, and `srcString` is null&hyphen;terminated&period; Note that if `dstCapacity` is 0, this function returns exactly 2 and `&ast;numCharsWritten` (if specified) is loaded with 0 (since there is insufficient space for the null terminator even for an empty input string)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlde/CharConvertUcs2/utf8ToUcs2-0d2.adoc[utf8ToUcs2](
    unsigned short* dstBuffer,
    std::size&lowbar;t dstCapacity,
    char const* srcString,
    std::size&lowbar;t* numCharsWritten = 0,
    unsigned short errorCharacter = &apos;?&apos;);
----

[.small]#xref:BloombergLP/bdlde/CharConvertUcs2/utf8ToUcs2-0d2.adoc[_» more&period;&period;&period;_]#


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