ASCII Codes

4D - Documentation   Français   English   German   Spanish   Japanese   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11 (Modified)


Compatibility Note: 4D can function with two character sets: Unicode or ASCII. The Unicode mode is the standard mode used in new databases beginning with version 11 of 4D. The ASCII mode is kept for compatibility reasons in databases created with an earlier version of 4D. This mode is called ASCII compatibility mode.

It is possible to apply the Unicode mode to converted databases via the Unicode Mode selector of the Get database parameter and SET DATABASE PARAMETER commands or via the Unicode Mode option found on the Application/Compatibility page of the Preferences:

In most cases, the initial functioning of applications is not affected by this setting, since 4D handles any necessary character conversions internally. Moreoever, the most common characters (a-z, 0-9, and so on) have the same value (from1 to 127) in both Unicode and ASCII (Windows and Mac OS).

However, certain language statements, more particularly those using commands that work with character strings, may require some adaptation. For example, the statement Char(200) will not return the same value in Unicode as in ASCII. This manual describes the differences in functioning between the Unicode mode and the ASCII compatibility mode for each command concerned.

Note: This mode is specific to each database. It is therefore possible to have a Unicode database coexisting with non-Unicode components (or vice versa).

Understanding ASCII Codes and 4D

When the database is operating in ASCII compatibility mode, on both Macintosh and Windows, the internal database engine and the 4D language work with the Macintosh extended ASCII set. When you enter data using the keyboard (adding records, editing procedures, etc.), 4D uses the internal Altura ASCII conversion scheme to convert what comes from the keyboard (expressed using the Windows set) to the Macintosh set. For example, to enter an "é", you type ALT+0233, and 4D stores ASCII code 142 in the record. This is transparent to the end user, because when you create a search, you actually type (in the Search editor) the value for which you are looking. Therefore, the value that you typed (ALT+0233) is also translated into ASCII code 142, and you find the value.

The codes work the same when you type ALT+0233 in the Procedure editor. However, to look for a character using its ASCII code, you use the Macintosh ASCII code of the character.

For example:

   QUERY (...; [MyFile]MyField="é") ` é is Alt+0233 

is the same as:

   QUERY (...;[MyFile]MyField=Char(142)) ` é is ASCII 142

ASCII Code Tables

The standard ASCII codes, 0 through 127, are common to Windows and Macintosh.

The ASCII codes 128 through 255 are different on Windows and Macintosh. In order to maintain platform independence, the Windows version of 4D automatically converts ASCII codes from Windows to Macintosh ASCII maps when characters are entering the 4D environment (Data entry, Edit/Paste, Import, etc.) and from Macintosh to Windows ASCII maps when characters are leaving the 4D environment (Edit/Cut or Copy, Export, etc.).

ASCII Codes 0 to 63

ASCII Codes 64 to 127

ASCII Codes 128 to 191

ASCII Codes 192 to 255

Note: The grayed out boxes indicate characters that are not available under Windows, or different from Macintosh characters.

See Also

Character code, ISO to Mac, Mac to ISO, Mac to Win, ON EVENT CALL, Win to Mac.


4D - Documentation   Français   English   German   Spanish   Japanese   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next