PreviousNext

Setting the Client's Locale

The first step in developing an internationalized RPC client is to add a call within the client code to a platform-specific function that sets the locale environment for the client. This step establishes

· The name of the client's local code set', which is the code set that processes on the host will use to encode character data.

· The names of the code sets for which converters exist on the host and consequently, into which processes that run on the host can convert if necessary.

The call to the locale-setting function must be the first call made within the client code. An example of a locale-setting function is the POSIX, XPG3, XPG4 setlocale( ) function, which is defined in locale.h.

The locale-setting function also establishes the value for two platform-specific macros that indicate

· The maximum number of bytes the local code set uses to encode one character.

· The maximum number of bytes that any of the supported code sets on the host will use to encode one character.

On the POSIX, XPG3, XPG4 platform, these macros are MB_CUR_MAX and MB_LEN_MAX and are defined in stdlib.h and limits.h, respectively. The buffer sizing routines use the MB_CUR_MAX macro when calculating the size of a new buffer to hold converted character data.

Note that all hosts that are members of an internationalized DCE cell must provide converters that convert between their supported code sets and the ISO 10646 "universal" code set. The DCE RPC functions for character and code set interoperability use the universal code set as the default "intermediate" code set into which a client or server can convert if there are no other compatible code sets between them. Writing the Evaluation Routine discusses intermediate code sets in more detail.