KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to set/get Unicode mode of the database
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: July 8, 2015

Databases created from 4D v11 and after have the ability to work natively with unicode characters. Unicode characters allows 4D applications to be internationalized, handling characters from any common language in the world.

Versions prior to 4D function in ACSII. Databases that have been created from versions prior to v11 and then upgraded to v11+ have the ability to change to unicode mode. There are a couple ways to do this.

1.) Through the database settings

Unicode mode can be set through the database settings under the compatibility tab(Design->Database Settings...->Compatibility). If the option (Unicode mode) is unchecked, the database is running in ASCII compatiblilty mode.


2.) Using Set/Get Database parameter

The mode the database is in can be found through the 4D command GET DATABASE PARAMETER using selector 41.
ex:

$mode:=GET DATABASE PARAMETER(41)
//$mode=0; database is in ASCII compatibility mode
//$mode=1; database is in Unicode mode


The mode can be changed using the 4D command SET DATABASE PARAMETER using selector 41.

To set the database to Unicode mode, run the following:
SET DATABASE PARaMETER(41;1)


To set the database to ASCII compatiblilty mode, run the following code
SET DATABASE PARaMETER(41;0)


Note: The the mode of the database is changed, the change will not take effect until the database has been restarted.