ctdb_u16TOu8
Converts a UTF-16 string to a UTF-8 encoding.
DECLARATION
NINT ctu16TOu8(pWCHAR u16str, pTEXT u8str, NINT u8size);
DESCRIPTION
ctdb_u16TOu8() converts a UTF-16 encoded string to a UTF-8 Unicode string. The input strings are assumed to be terminated by the nul character. All output buffer sizes are specified in bytes.
RETURN
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
No error occurred. |
153 |
VBSZ_ERR |
Output buffer too small. |
446 |
BMOD_ERR |
Bad key segment mode. |
See Appendix "c-tree Plus Error Codes" in the c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
EXAMPLE
TEXT buffer[512];
switch (ctdb_u16TOu8(tableName, buffer, sizeof(buffer))
{
case CTDBRET_OK:
{
printf("UTF-16 to UTF-8 conversion ok\n");
break;
}
case VBSZ_ERR:
{
printf("Conversion buffer is too small\n");
break;
}
case BMOD_ERR:
{
printf("Problem occurred during conversion\n");
break;
}
default:
{
printf("Unknown error code\n");
break;
}
}
SEE ALSO
ctdb_u8TOu16