USE CHARACTER SET

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

version 11 (Modified)


USE CHARACTER SET (map | *{; mapInOut})

ParameterTypeDescription
map | *String | *Name of character set to use (Unicode mode), or
Document name of ASCII map to use (ASCII mode) or
* to reset to default character set/ASCII map
mapInOutNumber0 = Output map
1 = Input map
If omitted, output map

Description

USE CHARACTER SET can be used to modify the character set used by 4D during transfer of data between the database and a document or a serial port. Transfer operations include the import and export of text (ASCII), DIF, and SYLK files. An ASCII map also works on data transferred with SEND PACKET, RECEIVE PACKET (for text type packets) and RECEIVE BUFFER. It has no effect on transfers of data done with SEND RECORD, SEND VARIABLE, RECEIVE RECORD, SEND PACKET and RECEIVE PACKET (for BLOB type packets) and RECEIVE VARIABLE.

The USE CHARACTER SET command is used differently according to whether the database is operating in Unicode mode or in ASCII compatibility mode. It loads into memory either a character set or an ASCII map.

Note: For more information about these modes, please refer to the About Unicode section.

Unicode Mode

In Unicode mode, the map parameter must correspond to the "IANA" name of the character set to be used, or to one of its aliases. For example, the names "iso-8859-1" or "utf-8" are both valid names, as well as the aliases "latin1" or "l1". For more information about these names, please refer to the following address: http://www.iana.org/assignments/character-sets. Examples if IANA names are also provided in the description of the CONVERT FROM TEXT command.

ASCII compatibility mode

In this mode, the command loads into memory and uses the ASCII map document (passed in map) that was previously saved. The ASCII map must have been created beforehand using a previous version of 4D. If you give an empty string for map, USE CHARACTER SET displays a standard Open File dialog box so that the user can specify an existing ASCII map.

If mapInOut is 0, the map is set for exporting. If mapInOut is 1, the map is set for importing. If you do not pass the mapInOut parameter, the export map is used by default.

When the * parameter is passed, the default character set is restored (import or export map depending on the value of mapInOut).

In Unicode mode in 4D v11, the default character set is UTF-8.

In compatibility mode compatibilité, the standard Mac ASCII is restored.

Example

The following example (Unicode mode) uses the UTF-16 character set to export a text, then the default character set is restored:

   USE CHARACTER SET ("UTF-16LE"; 0)   ` Use the UTF-16 'Little Endian' character set
   EXPORT TEXT ([MyTable]; "MyText")   ` Export data through the map 
   USE CHARACTER SET (*; 0)   ` Restore the default character set

See Also

EXPORT DIF, EXPORT SYLK, EXPORT TEXT, IMPORT DIF, IMPORT SYLK, IMPORT TEXT, Mac to Win, RECEIVE BUFFER, RECEIVE PACKET, SEND PACKET, Win to Mac.

System Variables or Sets

The OK system variable is set to 1 if the map is loaded correctly. Otherwise, it is set to 0.


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