BloombergLP::bdlde::CharConvertUtf16::utf16ToUtf8

Load into the destination the UTF-8 conversion of the UTF-16 source.

Synopsis

Declared in <bdlde_charconvertutf16.h>

static
int
utf16ToUtf8(
    char* dstBuffer,
    std::size_t dstCapacity,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numBytesWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Description

Return 0 on success and a non-zero status otherwise. See the first utf16ToUtf8 overload in this group for full contract details.

Return Value

0 on success and a non-zero status otherwise

Parameters

NameDescription
dstBufferdestination buffer for the converted output
dstCapacitycapacity of dstBuffer in elements
srcStringsource string to convert
numCodePointsWrittenif non-null, set to the code-point count written
numBytesWrittenif non-null, set to the byte count written
errorBytereplacement for invalid input, or 0 to skip
byteOrderUTF-16 byte order; host order if unspecified