[#BloombergLP-bdlde-CharConvertUcs2-ucs2ToUtf8-00] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlde.adoc[bdlde]::xref:BloombergLP/bdlde/CharConvertUcs2.adoc[CharConvertUcs2]::ucs2ToUtf8 :relfileprefix: ../../../ :mrdocs: `ucs2ToUtf8` overloads == Synopses Declared in `<bdlde_charconvertucs2.h>` Load into `result` the UTF‐8 conversion of the null‐terminated UCS‐2 `srcString`. Optionally report characters written via `numCharsWritten`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-01.adoc[ucs2ToUtf8]( xref:bsl/string.adoc[bsl::string]* result, unsigned short const* srcString, std::size_t* numCharsWritten = 0); ---- [.small]#xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-01.adoc[_» more..._]# Load into `result` the UTF‐8 conversion of the null‐terminated UCS‐2 `srcString`. Optionally report characters written via `numCharsWritten`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-0b.adoc[ucs2ToUtf8]( std::pmr::string* result, unsigned short const* srcString, std::size_t* numCharsWritten = 0); ---- [.small]#xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-0b.adoc[_» more..._]# Load into `result` the UTF‐8 conversion of the null‐terminated UCS‐2 `srcString`. Optionally report characters written via `numCharsWritten`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-06.adoc[ucs2ToUtf8]( std::string* result, unsigned short const* srcString, std::size_t* numCharsWritten = 0); ---- [.small]#xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-06.adoc[_» more..._]# Load, into the specified `dstBuffer` of the specified `dstCapacity`, the result of converting the specified null‐terminated UCS‐2 `srcString` to its UTF‐8 equivalent. Optionally specify `numCharsWritten` which (if not 0) indicates the modifiable integer into which the number of _UTF‐8 characters_ written (including the null terminator) is to be loaded. Optionally specify `numBytesWritten` which (if not 0) indicates the modifiable integer into which the number of _bytes_ written (including the null terminator) is to be loaded. Return 0 on success and a bitwise‐or of the masks specified by `CharConvertStatus::Enum` otherwise, with `CharConvertStatus::k_INVALID_INPUT_BIT` set to indicate that at least one invalid input sequence was encountered, and `CharConvertStatus::k_OUT_OF_SPACE_BIT` set to indicate that `dstCapacity` was insufficient to accommodate the output. If `dstCapacity` was insufficient, the maximal null‐terminated prefix of the properly converted result string is loaded into `dstBuffer`. The behavior is undefined unless `0 <= dstCapacity`, `dstBuffer` refers to an array of at least `dstCapacity` elements, and `srcString` is null‐terminated. Note that if `dstCapacity` is 0, this function returns exactly 2 and `*numCharsWritten` and `*numBytesWritten` (if not null) are loaded with 0 (since there is insufficient space for the null terminator even for an empty input string). Also note that since UTF‐8 is a variable‐length encoding, it is possible for `numBytesWritten` to be greater than `numCharsWritten`, and therefore that an input `srcString` of `dstCapacity ‐ 1` _characters_ may not fit into `dstBuffer`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-03.adoc[ucs2ToUtf8]( char* dstBuffer, std::size_t dstCapacity, unsigned short const* srcString, std::size_t* numCharsWritten = 0, std::size_t* numBytesWritten = 0); ---- [.small]#xref:BloombergLP/bdlde/CharConvertUcs2/ucs2ToUtf8-03.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#