[#BloombergLP-bdlde-CharConvertUtf32-utf32ToUtf8-033]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/CharConvertUtf32.adoc[CharConvertUtf32]::utf32ToUtf8
:relfileprefix: ../../../
:mrdocs:

Convert the UTF&hyphen;32 source of given length into UTF&hyphen;8 in `dstVector`&period;

== Synopsis

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

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

== Description

Load into the destination the UTF&hyphen;8 conversion of the UTF&hyphen;32 source&period; Return 0 on success and a non&hyphen;zero status otherwise&period; See the first `utf32ToUtf8` overload in this group for full contract details&period;

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *dstVector*
| destination for the null&hyphen;terminated UTF&hyphen;8 result
| *srcString*
| UTF&hyphen;32 source buffer to convert
| *srcStringLength*
| number of UTF&hyphen;32 values to convert
| *numCodePointsWritten*
| if non&hyphen;null, receives the number of UTF&hyphen;8 code points written
| *errorByte*
| optional substitute for invalid UTF&hyphen;32 values&semi; 0 writes nothing
| *byteOrder*
| byte order of the UTF&hyphen;32 input (host by default)
|===


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