Language numbers

KCML has a convention for numberering supported languages. It was originally devised for use in byte 20 of $OPTIONS RUN to specify the language for the chevron notation used for internationalized strings but it is optional in that context and many applications prefer to use their own numbering scheme.

The language number can be set into byte 61 of $OPTIONS RUN to specify the code page to use when converting between UTF-8 and a Microsoft code page using the E="UTF-8" extended form of $PACK. The generic KCML client expects data encoded in the native locale of Windows so it is often necessary to translate Unicode data into this encoding to display it properly. As of KCML 6.20 there is available a Unicode version of the client which can display Unicode data irrespective of the Windows locale settings. However this requires an NT version of Windows and will not work with Windows 95 or 98.

This byte should be set to HEX(FF) if the server is running in Unicode mode, i.e. with the environment variable USING_UTF8 set, as the UTF-8 pack format will just become a copy.

On non-Unicode systems, where the USING_UTF8 environment variable is not set, the language number in byte 61 is also used by the SOAP client to determine the encoding to use in SOAP request messages. This encoding is used in both the XML header and in the HTTP MIME header. Note that there is no guarantee that the SOAP server will be able to accept anything other than UTF-8, UTF-16 or possibly Latin-1 so for maximum interoperability you should leave this byte set to either zero or HEX(FF) and use $PACK to translate any strings that are not encoded in UTF-8 before passing them in a method call. In all cases the SOAP client returns UTF-8 strings irrespective of the value of byte 61.

It is also used in $MACHINE byte 33 to indirectly indicate the kclient's user locale in Microsoft Windows. The client arrives at the language code by starting with the locale. Some locales are split e.g. UK English and US English and such split locales will have a default for all the locales that are not explicitly checked. Thus for English the locale is defaulted to be US English unless specifically identified as UK English. In the case of Chinese the exceptions are HongKong and Taiwan which are presumed to be Traditional. All other Chinese locales (PRC, Singapore) are assumed to be Modern.

Note that the client will only check the PC locale when it starts up and if the user's locale is changed in the Windows Control Panel while the client is running, neither the client nor the server will be aware of the change.

Support for converting character sets from Unicode to Microsoft code pages on Unix servers is implemented using a number of code page files, one for each code page, e.g. CP949.map for Korean, which must be in the KCML directory.

Language codes 17 to 20 were added to KCML 6.20+ after build 13326.

Language codes 21 to 24 were added KCML 7 in build 19219 and to KCML 6.20 in build 21268.

CodeConstantCodePageLocaleSOAP
Encoding
Language
0KLANG_DEFAULT  UTF-8Default, language unknown
1KLANG_EN_GBCP1252en_GBISO-8859-1English (UK)
2KLANG_DECP1252de_DEISO-8859-1German
3KLANG_FRCP1252fr_FRISO-8859-1French
4KLANG_ESCP1252es_ESISO-8859-1Spanish
5KLANG_ITCP1252it_ITISO-8859-1Italian
6KLANG_PTCP1252pt_PTISO-8859-1Portuguese
7KLANG_NLCP1252nl_NLISO-8859-1Dutch
8KLANG_PLCP1250pl_PLISO-8859-2Polish
9KLANG_EN_USCP1252en_USISO-8859-1English (US)
10KLANG_KOCP949ko_KRISO-2022-KRKorean
11KLANG_HUCP1250hu_HUISO-8859-1Hungarian
12KLANG_JPCP932ja_JPCP932Japanese
13KLANG_ZH_TRADCP950zh_TWCP950Chinese (Traditional)
14KLANG_ZH_MODCP936zh_CNCP936Chinese (Simplified)
15KLANG_TRCP1254tr_TRISO-8859-9Turkish
16KLANG_THCP874th_THISO-8859-11Thai
17KLANG_CYCP1251ru_RUISO-8859-5Cyrillic
18KLANG_GRCP1253el_GRISO-8859-7Greek
19KLANG_ARCP1256ar_AAISO-8859-6Arabic
20KLANG_BACP1257lv_LVISO-8859-13Baltic
21KLANG_VNCP1258vi_VNCP1258Vietnamese
22KLANG_SVCP1252sv_SEISO-8859-1Swedish
23KLANG_DACP1252da_DKISO-8859-1Danish
24KLANG_NOCP1252no_NOISO-8859-1Norwegian
25KLANG_FR_CACP1252fr_CAISO-8859-1French (CA)
26KLANG_MS_MYCP1252ms_MYISO-8859-1Malaysia (MS)
27KLANG_AR_XTCP1256ar_AAISO-8859-6Arabic (Extended) [default for Arabic]
255KLANG_UTF8  UTF-8UTF-8