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

Load into `result` the UTF&hyphen;8 conversion of the null&hyphen;terminated UCS&hyphen;2 `srcString`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
ucs2ToUtf8(
    std::pmr::string* result,
    unsigned short const* srcString,
    std::size&lowbar;t* numCharsWritten = 0);
----

== Description

Return 0 on success and a non&hyphen;zero status otherwise&period; See the `bsl&colon;&colon;string` overload of `ucs2ToUtf8` for full contract details&period;

== Return Value

0 on success and a non&hyphen;zero status otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| output string for the UTF&hyphen;8 conversion
| *srcString*
| null&hyphen;terminated UCS&hyphen;2 input
| *numCharsWritten*
| if non&hyphen;null, receives character count written
|===


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