From EDM2
(Redirected from OS2 API:UniUconvToUcs)
Jump to: navigation, search

Convert a code page string to a UCS string.


UniUconvToUcs(uconvObj, inBuffer, inBufferLen, ucsBuffer, ucsBufferLen, nonIdenticalConv) 


uconvObj - UconvObject - input
The conversion object created from UniCreateUconvObject.
inBuffer - (void **) - input
The input buffer.
inBufferLen - (size_t *) - input/output
The input buffer's length, in bytes.
ucsBuffer - UniChar - output
The ucs buffer.
ucsBufferLen - (size_t *) - output
Number of Unicode character elements in the ucsBuffer.
nonIdenticalConv - (size_t *) - output
Number of non-identical conversions.




An integer with values of:


UniUconvToUcs updates the variables pointed to by the arguments to reflect the extent of the conversion and returns, in nonidentical, the number of substitutions (non-identical conversions) performed. If the entire string in the input buffer is converted, the value pointed to by inBufferLen will be 0. If the input conversion is stopped due to any condition mentioned above, the value pointed to by inBufferLen will be nonzero and a nonzero value is returned to indicate the condition. If an error occurs, UniUconvToUcs returns a nonzero value.


Define (C/C++)

Export name/Ordinal

Calling Convention


Example Code

UconvObject uconvObj;
void**      inBuffer;
size_t*     inBufferLen;
UniChar     ucsBuffer;
size_t*     ucsBufferLen;
size_t*     nonIdenticalConv;
integer     rc;
rc = UniUconvToUcs(uconvObj, inBuffer, inBufferLen, ucsBuffer, ucsBufferLen, nonIdenticalConv);

Related Functions


The sequence of the code page characters in inBuffer is converted into a sequence of Unicode characters in ucsBuffer. The code page was set by UniCreateUconvObject call in the UconvObject.

Conversion is only on bytes that convert. The process stops converting on the first non-valid byte. If the ucsBuffer isn't large enough, conversion ends on the byte previous to any buffer overflow. inBuffer is updated truncating the point of failure to the end and updating the ucsBufferLen to indicate the number of successfully converted elements.

OS Version Introduced

OS/2 Warp