GT.M operates in two modes – M mode and UTF-8 mode. Users can switch between M mode and UTF-8 mode depending on the character set of the underlying data. Users must set GT.M to:
M mode while accessing ASCII character set from the database. In this mode, GT.M treats all 256 combinations of the 8 bits in a byte as a character. For applications for which a 128 or 256 character encoding is sufficient, M mode is somewhat more efficient. Note: switching from a strictly ASCII (128 character) encoding is simple because the first 128 characters of UTF-8 are identical to ASCII, switching from a 256 character (typically an ISO ASCII-Latin variant) is much more complex because you must remap all characters with codes from 128-255 to appropriate UTF-8 equivalents
UTF-8 mode while accessing Unicode characters from the database. In UTF-8 mode, all functionality related to Unicode™ becomes available and standard string-oriented operations (particularly intrinsic functions) operate with UTF-8 encoding. In UTF-8 mode, GT.M detects character boundaries (especially when the size of a character is greater than 1 byte), calculates glyph display width, and performs string conversion between UTF-8 and UTF-16.
|
|
|
UTF-8 mode is an optional alternative way to input, output, and interpret as strings the arbitrary sequences of bytes in the indexes and values of global and local variables. See "Unicode Technical Bulletin" for more information on GT.M support for Unicode. |
The following is a sample command sequence to change the system environment from M mode to UTF-8 mode. Assume that $ gtm_dist has been defined and is set to /usr/local/gtm:
gtmroutines=". $gtm_dist/utf8 $gtm_dist" export gtmroutines gtm_dist=$gtm_dist/utf8 export $gtm_dist $gtm_chset="UTF-8" $export gtm_chset
The following is a sample command sequence to change the system environment from UTF-8 mode to M mode. Assume that $ gtm_dist has been defined and is set to /usr/local/gtm/utf8:
$gtm_dist=`echo $gtm_dist | sed 's/utf8\(\/\)*//'`" $ export gtm_dist $ gtmroutines=". $gtm_dist” $ export gtmroutines $ gtm_chset=”M”