Replace UTF-8 error sequences in input and write to output.
Declared in <bdlde_utf8util.h>
static
size_type
replaceErrors(
bsl::string* output,
std::string_view const& input,
unsigned int utf32ErrorCode = k_ERROR_CODE_POINT);
Translate the specified input, which is UTF-8, replacing error sequences in input with utf32ErrorCode translated to UTF-8, and return the number of errors found, putting the result in *output. Any previous contents of *output are discarded. If utf32ErrorCode is 0, error sequences will be simply deleted. The behavior is undefined unless utf32ErrorCode is a valid unicode value for UTF-8.
number of error sequences replaced (or deleted)
| Name | Description |
|---|---|
| output | string that receives the corrected UTF-8 result |
| input | UTF-8 text that may contain error sequences |
| utf32ErrorCode | Unicode value substituted for each error |