Encodings

The encoding choices for both phrase-checks and length-encodeds are:

ascii (radix: radix, width: field-width, \
justification: just, pad: pad-char )
  • radix: is optional. If present, then use 8, 10, or 16, indicating the base choice. If not specified, then base 10 is used.
  • width: is required. Variable-width-length fields are not currently supported.
  • justification: is optional. If specified, then use left or right. If not specified, then it defaults to right.
  • pad: is optional. If specified, then use a character-constant or an identifier which names a single character. Zero (0) is the default pad character.

This encoding represents the value as a number written in ASCII. It can represent numbers in octal, decimal, or hexidecimal notation.

Note: The parameters are specified as comma-separated lists of keywords and values. The arguments are order-insensitive and usually optional.
This table shows encoding examples:
Parameter Description
ascii (radix: 16, width: 4, pad: 0) Accepts and generates, for example: 03e8, 00ff.
ascii (radix: 8, width: 10, pad: 0) Accepts and generates, for example: 1750, 777.
ascii (width: 5) Accepts and generates, for example: 01000, 19999.
native (bytes: bytes) This is a binary-encoding, using the computer’s built-in byte-order. Set bytes as 1, 2, or 4. Declare the field as fixed-array (bytes,any), where the field’s bytes is the same as bytes in the built-in "( )" declaration.
network (bytes: bytes) This binary coding is basically the same as the built-in, except it uses acknowledged (network) byte order instead of the built-in byte order.