Character Encoding Conversion (X) |
|
|
The X conversion code applies a character encoding.
The format of the conversion code is
Xname Xname.modes
where
Used as an output conversion, the X conversion code takes internal data and encodes it to an external representation such as UTF-8. Used as an input conversion, the data is transformed from its external representation to a QM character string. Although primarily intended for use on ECS mode systems, the X conversion code is supported on non-ECS mode systems but limited to the 8 bit character set.
See Character Encodings for a description of the built-in encodings.
Users can add their own encodings by cataloguing a pair of QMBasic subroutines named ENCODE.name and DECODE.name where name is the encoding name to be defined. These subroutines should be declared as SUBROUTINE ENCODE.name(RESULT, STR, MODES, STATUS) and SUBROUTINE DECODE.name(RESULT, STR, MODES, STATUS) where
Encodings defined in this way can be used in all places where a character encoding name is used by QM.
The status value returned by the subroutine should follow the standard rules for conversion codes:
|