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.
| Code | Constant | CodePage | Locale | SOAP Encoding | Language |
|---|---|---|---|---|---|
| 0 | KLANG_DEFAULT | UTF-8 | Default, language unknown | ||
| 1 | KLANG_EN_GB | CP1252 | en_GB | ISO-8859-1 | English (UK) |
| 2 | KLANG_DE | CP1252 | de_DE | ISO-8859-1 | German |
| 3 | KLANG_FR | CP1252 | fr_FR | ISO-8859-1 | French |
| 4 | KLANG_ES | CP1252 | es_ES | ISO-8859-1 | Spanish |
| 5 | KLANG_IT | CP1252 | it_IT | ISO-8859-1 | Italian |
| 6 | KLANG_PT | CP1252 | pt_PT | ISO-8859-1 | Portuguese |
| 7 | KLANG_NL | CP1252 | nl_NL | ISO-8859-1 | Dutch |
| 8 | KLANG_PL | CP1250 | pl_PL | ISO-8859-2 | Polish |
| 9 | KLANG_EN_US | CP1252 | en_US | ISO-8859-1 | English (US) |
| 10 | KLANG_KO | CP949 | ko_KR | ISO-2022-KR | Korean |
| 11 | KLANG_HU | CP1250 | hu_HU | ISO-8859-1 | Hungarian |
| 12 | KLANG_JP | CP932 | ja_JP | CP932 | Japanese |
| 13 | KLANG_ZH_TRAD | CP950 | zh_TW | CP950 | Chinese (Traditional) |
| 14 | KLANG_ZH_MOD | CP936 | zh_CN | CP936 | Chinese (Simplified) |
| 15 | KLANG_TR | CP1254 | tr_TR | ISO-8859-9 | Turkish |
| 16 | KLANG_TH | CP874 | th_TH | ISO-8859-11 | Thai |
| 17 | KLANG_CY | CP1251 | ru_RU | ISO-8859-5 | Cyrillic |
| 18 | KLANG_GR | CP1253 | el_GR | ISO-8859-7 | Greek |
| 19 | KLANG_AR | CP1256 | ar_AA | ISO-8859-6 | Arabic |
| 20 | KLANG_BA | CP1257 | lv_LV | ISO-8859-13 | Baltic |
| 21 | KLANG_VN | CP1258 | vi_VN | CP1258 | Vietnamese |
| 22 | KLANG_SV | CP1252 | sv_SE | ISO-8859-1 | Swedish |
| 23 | KLANG_DA | CP1252 | da_DK | ISO-8859-1 | Danish |
| 24 | KLANG_NO | CP1252 | no_NO | ISO-8859-1 | Norwegian |
| 25 | KLANG_FR_CA | CP1252 | fr_CA | ISO-8859-1 | French (CA) |
| 26 | KLANG_MS_MY | CP1252 | ms_MY | ISO-8859-1 | Malaysia (MS) |
| 27 | KLANG_AR_XT | CP1256 | ar_AA | ISO-8859-6 | Arabic (Extended) [default for Arabic] |
| 255 | KLANG_UTF8 | UTF-8 | UTF-8 |