To send and receive 2-byte characters, the client specifies its preferred byte order during the login phase of the connection. Any necessary byte-swapping is performed on the server side.
The Open Client ct_capability() parameters are as follows:
CS_DATA_UNITEXT – is a request sent to the server to determine whether the server supports 2-byte Unicode datatypes.
CS_DATA_NOUNITEXT – is a parameter sent from the client to tell the server not to send unitext for this specific connection.
To access 2-byte character data, Open Client and Open Server implements the following:
CS_UNITEXT – a datatype.
CS_UNITEXT_TYPE – a datatype constant to identify the data’s datatype.
Setting the CS_DATAFMT parameter’s datatype to CS_UNITEXT_TYPE allows you to use existing API calls, such as ct_bind, ct_describe, ct_param, ct_setparam, cs_convert and so on.
Since CS_UNITEXT is encoded as a UTF-16 Unicode datatype and stored in the 2-byte format, it can be used anywhere CS_TEXT is used. The maximum length of the CS_UNITEXT string parameter is half of the maximum length of CS_TEXT.
Like CS_TEXT, CS_UNITEXT uses CS_DATAFMT to describe the destination format. The symbols and meanings of the format field values are as follows:
Bitmask field |
Description |
---|---|
CS_FMT_NULLTERM |
The data is 2-byte Unicode null-terminated (0x0000). |
CS_FMT_PADBLANK |
The data is padded with 2-byte Unicode blanks to the full length of the destination variable (0x0020). |
CS_FMT_PADNULL |
The data is padded with 2-byte Unicode nulls to the full length of the destination variable (0x0000). |
CS_FMT_UNUSED |
No format information is provided. |