cciMbsToUcs

Converts multi-byte string data to Universal Character Set (UCS).

Syntax

int cciMbsToUcs(
  int*         returnCode,
  const char*  mbString,
  CciChar*     ucsString,
  int          ucsStringLength,
  int          codePage);

Parameters

returnCode
The return code from the function (output). Possible return codes are:
  • CCI_SUCCESS
  • CCI_BUFFER_TOO_SMALL
  • CCI_INV_CHARACTER
  • CCI_FAILURE
  • CCI_INV_CODEPAGE
mbString
The string to be converted, expressed as 'file code' (input).
ucsString
The location of the resulting UCS-2 Unicode string (input). This has a trailing CciChar of 0, just as the mbString has a trailing byte of 0.
ucsStringLength
The length (in CciChars) of the buffer that you have provided (input). Each byte in mbString expands to not more than one CciChar and this defines an upper limit for the buffer size required.
codePage
The code page of the source string (input). The value of the code page should be suitable for the compiler that is being used to compile the user-defined node.

For an ASCII system, a value of 1208 (meaning code page ibm-1208, which is UTF-8 Unicode) is a good choice if you are using cciMbsToUcs to convert string constants for processing by WebSphere Message Broker. 1208 is appropriate for Linux and UNIX, and for Windows platforms.

On Linux and UNIX, nl_langinfo(CODEPAGE) gives you the code page that has been selected by setlocale.

For OS/390 and z/OS, the default code page for WebSphere MQ, which is 500, should not be used. Instead, you should use a code page value of 1047.

Return values

The converted length in half-words (UCS-2 characters).

Related concepts
User-defined extensions