UniUconvToUcs converts a sequence of characters encoded in one code page, in the array specified by inbuf, into a sequence of corresponding UCS code elements, in the array specified by ucsbuf. The code page of the inbuf is the string specified in the UniCreateUconvObject call that returned the conversion object, uconv_object. The inbuf argument points to a variable that points to the first byte in the input buffer, and the inbytesleft indicates the number of bytes to the end of the buffer to be converted. The ucsbuf argument points to a variable that points to the first available UniChar in ucsbuf, and UniCharsleft indicates the number of UniChar elements available to the end of the buffer.
If a sequence of bytes within inbuf does not form a valid character in the specified code page, conversion stops after the previous successfully converted character. If the input buffer ends with an incomplete character, conversion stops after the previous successfully converted bytes. If the ucsbuf buffer is not large enough to hold the entire converted input, conversion stops just prior to the input bytes that would cause the output buffer to overflow. The variable pointed to by inbuf is updated to point to the byte following the last byte successfully used in the conversion. The value pointed to by UniCharsleft is decremented to reflect the number of UniChar elements still available in ucsbuf.
If UniUconvToUcs encounters a character in the inbuf that is legal, but for which an identical character does not exist in UCS, UniUconvToUcs replaces the character with a predefined substitution character, if the attributes of the conversion object allow this operation. If substitution is not selected, an error is returned.