SetCharacterEncoding method

[method icon] SetCharacterEncoding(Encoding$, DefaultFont$)

>KClient_SetCharacterEncoding

KClient_SetCharacterEncoding

The KClient_SetCharacterEncoding method allows KCML to specify the character encoding used by the application when it is not a standard Windows encoding. Currently this method is only likely to be needed on Japanese systems, where the standard DBCS Windows encoding (code page 932), can be replaced by the superset character set JIS2004 using the encoding SHIFT_JIS-2004. This enables a wider range of characters than the JIS1990 set supported in JIS2004.

To make KClient use a wider character set the font used for forms must include all the characters of the character set. For the SHIFT_JIS-2004 character tset, the Windows font "Meiryo" may be used. This is supplied as standard with Window Vista and later versions of Windows. For XP it may be downloaded.

An example of using this function is

	OBJECT KClient = CREATE "ClientCOM","KClient"
	result = KClient.SetCharacterEncoding("SHIFT_JIS-2004","Meiryo")
	

This function returns 0 for success and positive error code for failure. Possible error codes are 1 (failure to load libiconv-2.dll) or 2 (the specified character encoding is not supported). It is possible more error codes will be added in future. If this method is used with an older KClient which does not support it then a run-time error will occur. This can be caught with an ERROR DO statement.

Installation

To change to using SHIFT_JIS-2004 from the standard Windows code page 932 means you need to update all copies of KClient connecting to the system. This functionality has been added to KClient 6.20, 6.90 and all later versions, starting with build 16131. For KClient 6.20 the Unicode version of KClient must be used; for KClient 6.90 and later all versions of KClient are Unicode. No changes to KCML are necessary and a 6.90 KClient can be used against a 6.20 KCML. Using an older copy of KClient will mean that the newer characters will be displayed as a question-mark, box or other character. Editing a field containing such a character will lose the original character from the application and database.

The translation library is provided by a third-party dll, libiconv-2.dll, which must be copied into the same directory as kclient.exe. This dll has an LGPL license, and is made available on the www.kcml.com website for convenience. The src code, license and further information on this dll may be found on the gnu libiconv website.

See also:

BrandSplash, CameraCapture, ClearDirectoryWatchEvent, CreateBookMark, DisplayScreen, EmptyClientCache, EnableUserPreferences, EnableWarnings, FireServiceEvent, ForceDefaultFont, ForceReadableTextMode, FTPGet, FTPPut, GetForms, GetServiceAttribute, GetServiceCookie, GetSpecialFolderPath, HTTPGet, OpenServiceWindow, PlaySoundFile, SetDefaultIMEMode, SetDirectoryWatchEvent, SetPrinterFontName, SetPrinterFontSize, SetPrinterPort, SetServiceAttribute, SetServiceCaption, SetServiceConnection, SetServiceCookie, SetServiceUrl, SetThrottle, ShowSIP