cciUcsToMbs

Converts Universal Character Set (UCS) data to multi-byte string data. This function is, typically, used only for formatting diagnostic messages. Normal processing is best done in UCS-2, which can represent all characters from all languages.

The sample code (BipSampPluginUtil.c) shows more utilities for processing UCS-2 characters in a portable way.

Syntax

int cciUcsToMbs(
  int*           returnCode,
  const CciChar* ucsString,
  char*          mbString,
  int            mbStringLength,
  int            codePage);

Parameters

returnCode
The return code from the function (output).
ucsString
The string to be converted, expressed as UCS-2 Unicode (input).
mbString
The location of the resulting string (input). The string has a trailing byte of 0, just as the Unicode has a trailing CciChar of 0.
mbStringLength
The length (in bytes) of the buffer that you have provided (input). Each CciChar in the source string expands to one byte (for SBCS code pages), or up to not more than the code page's MB_CUR_MAX value (typically less than five bytes), which defines an upper limit of the buffer size required.
codePage
The code page that you require (input). On a Unix system, nl_langinfo(CODEPAGE) gives you the code page that has been selected by setlocale. 1208 gives you UTF-8 Unicode.

Return values

The converted length in bytes.

Related concepts
User-defined extensions

Related tasks
Creating an input node in C
Creating a message processing node in C
Creating a parser in C

Related reference
User-defined extensions
cciMbsToUcs