4D v13.4

USE CHARACTER SET

Home

 
4D v13.4
USE CHARACTER SET

USE CHARACTER SET 


 

USE CHARACTER SET ( map {; mapInOut} ) 
Parameter Type   Description
map  String, Operator in 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
mapInOut  Longint in 0 = Output map 1 = Input map If omitted, output map

USE CHARACTER SET modifies the character set used by 4D during data transfer between the database and a document or a serial port for the current process. 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, RECEIVE PACKET (for BLOB type packets) und 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 ASCII Codes 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, 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

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

 
PROPERTIES 

Product: 4D
Theme: Communications
Number: 205

The OK variable is changed by the commandThe Unicode mode affects this command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D v11 SQL

 
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