BloombergLP::bdlde::CharConvertUtf16::utf8ToUtf16

utf8ToUtf16 overloads

Synopses

Declared in <bdlde_charconvertutf16.h>

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

static
int
utf8ToUtf16(
    bsl::u16string* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    std::pmr::u16string* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    std::u16string* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    bsl::wstring* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    std::pmr::wstring* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    std::wstring* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static
int
utf8ToUtf16(
    char16_t* dstBuffer,
    std::size_t dstCapacity,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    unsigned short* dstBuffer,
    std::size_t dstCapacity,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

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

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

static
int
utf8ToUtf16(
    wchar_t* dstBuffer,
    std::size_t dstCapacity,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);
» more...

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

static
int
utf8ToUtf16(
    wchar_t* dstBuffer,
    std::size_t dstCapacity,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    wchar_t errorWord = '?',
    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
errorCharreplacement for invalid input, or 0 to skip
byteOrderUTF-16 byte order; host order if unspecified
errorWordreplacement for invalid input, or 0 to skip
dstVectordestination for the converted output
dstBufferdestination buffer for the converted output
dstCapacitycapacity of dstBuffer in elements
numWordsWrittenif non-null, set to the word count written