Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString.
Synopsis
Declared in <bdlde_charconvertucs2.h>
static
int
utf8ToUcs2(
bsl::vector<unsigned short>* result,
char const* srcString,
unsigned short errorCharacter = '?');
Description
Load into the specified result the conversion of the specified null‐terminated UTF‐8 srcString to its null‐terminated UCS‐2 equivalent. Optionally specify errorCharacter to be substituted for invalid (i.e., not convertible to UCS‐2) input characters. If errorCharacter is 0, invalid input characters are ignored (i.e., produce no corresponding output characters). Return 0 on success and CharConvertStatus::k_INVALID_INPUT_BIT otherwise, meaning that at least one sequence of characters was encountered that could not be translated to UCS‐2. If the return value has CharConvertStatus::k_INVALID_INPUT_BIT set, one or more input characters are invalid (in which case the conversion continues). The behavior is undefined unless srcString is null‐terminated. Note that the null‐terminating word counts towards result‐>size().
Return Value
0 on success and CharConvertStatus::k_INVALID_INPUT_BIT 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 |
Created with MrDocs