Initializing help system before first use

XNLSconvstrto

XNLSconvstrto


Purpose
Convert a UTF-8 text string to a given encoding.
Synopsis
const char *XNLSconvstrto(int eid, const char *src, int srclen, int *dstlen);
Arguments
eid 
Encoding ID of the destination
src 
Text buffer to transcode
srclen 
Length in bytes of the source text buffer (or -1 for a null terminated string)
dstlen 
A location where to return the length (in bytes) of the generated string (can be NULL)
Return value
The converted null terminated string or NULL in case of memory allocation error.
Further information
1. This function returns a thread-specific statically allocated buffer that it shares with XNLSconvstrfrom: each call to any of these functions will overwrite the result of the previous call.
2. Any invalid character is replaced by a default symbol (specific to the destination encoding) in the converted string.
3. Mosel uses this function extensively: it is therefore recommended to duplicate any string returned by this routine if you need to pass it to a Mosel API function. Alternatively, use the XNLSconvbufto form of this function where you can specify your own buffer.
Related topics