utf8ToUcs2 overloads

Synopses

Declared in <bdlde_charconvertucs2.h>

Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString.

static
int
utf8ToUcs2(
    bsl::vector<unsigned short>* result,
    char const* srcString,
    unsigned short errorCharacter = '?');

Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString.

static
int
utf8ToUcs2(
    std::pmr::vector<unsigned short>* result,
    char const* srcString,
    unsigned short errorCharacter = '?');

Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString.

static
int
utf8ToUcs2(
    std::vector<unsigned short>* result,
    char const* srcString,
    unsigned short errorCharacter = '?');

Convert a null‐terminated UTF‐8 string to UCS‐2 in a fixed buffer.

static
int
utf8ToUcs2(
    unsigned short* dstBuffer,
    std::size_t dstCapacity,
    char const* srcString,
    std::size_t* numCharsWritten = 0,
    unsigned short errorCharacter = '?');

Return Value

  • 0 on success and CharConvertStatus::k_INVALID_INPUT_BIT otherwise

  • 0 on success and a non‐zero status otherwise

  • 0 on success and a bitwise‐or of the masks specified by CharConvertStatus::Enum otherwise

Parameters

Name

Description

result

output vector for the UCS‐2 conversion

srcString

null‐terminated UTF‐8 input

errorCharacter

substitute for invalid input; 0 skips them

dstBuffer

output buffer for the UCS‐2 conversion

dstCapacity

capacity of dstBuffer in `unsigned short`s

numCharsWritten

if non‐null, receives character count written

Created with MrDocs