BloombergLP::bdlde::CharConvertUtf16::utf16ToUtf8

utf16ToUtf8 overloads

Synopses

Declared in <bdlde_charconvertutf16.h>

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

static
int
utf16ToUtf8(
    bsl::string* dstString,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::string* dstString,
    std::wstring_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::string* dstString,
    char16_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

Convert the UTF-16 source to UTF-8 in the destination.

static
int
utf16ToUtf8(
    bsl::string* dstString,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::string* dstString,
    wchar_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::string* dstString,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::string* dstString,
    std::wstring_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::string* dstString,
    char16_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::string* dstString,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::string* dstString,
    wchar_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::string* dstString,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::string* dstString,
    std::wstring_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::string* dstString,
    char16_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::string* dstString,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::string* dstString,
    wchar_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

Convert the UTF-16 source to UTF-8 in the destination.

static
int
utf16ToUtf8(
    bsl::vector<char>* dstVector,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::vector<char>* dstVector,
    std::wstring_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::vector<char>* dstVector,
    char16_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

Convert the UTF-16 source to UTF-8 in the destination.

static
int
utf16ToUtf8(
    bsl::vector<char>* dstVector,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::vector<char>* dstVector,
    wchar_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::vector<char>* dstVector,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::vector<char>* dstVector,
    std::wstring_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::vector<char>* dstVector,
    char16_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::vector<char>* dstVector,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::vector<char>* dstVector,
    wchar_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::vector<char>* dstVector,
    std::u16string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::vector<char>* dstVector,
    std::wstring_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::vector<char>* dstVector,
    char16_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::vector<char>* dstVector,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::vector<char>* dstVector,
    wchar_t const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::string* dstString,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::string* dstString,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::string* dstString,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    bsl::vector<char>* dstVector,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::pmr::vector<char>* dstVector,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf16ToUtf8(
    std::vector<char>* dstVector,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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);
» more...

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

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

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

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

Convert the UTF-16 source to UTF-8 in the destination.

static
int
utf16ToUtf8(
    char* dstBuffer,
    std::size_t dstCapacity,
    unsigned short const* srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numBytesWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf16ToUtf8(
    char* dstBuffer,
    std::size_t dstCapacity,
    unsigned short const* srcString,
    std::size_t srcLengthInWords,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numBytesWritten = 0,
    char errorByte = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

Return Value

  • 0 on success and a non-zero status otherwise
  • 0 on success and CharConvertStatus::k_INVALID_INPUT_BIT otherwise
  • 0 on success and a bitwise-or of the bits specified by CharConvertStatus::Enum otherwise

Parameters

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