ISO 8583 implementation reference

Bytes and encoding

Understand the difference between a value, its encoded bytes and the length prefix used to frame it.

A value and its bytes are different

The characters 1234 take four bytes in ASCII: 31 32 33 34 in hexadecimal. The same displayed digits take two bytes as packed decimal: 12 34. Choosing the wrong representation moves the start of every following field.

ASCII31 32 33 34Four bytes
Packed decimal12 34Two bytes

In pyiso8583, binary encoding accepts a hexadecimal representation of bytes. A numeric looking input is not automatically checked against a network’s allowed values.

Keep the prefix separate from the value

An ASCII LLVAR field uses two ASCII bytes for its length. A five character value ABCDE is framed as 05ABCDE. The prefix describes the payload length and is not part of the value.

Length prefix05Two ASCII bytes
ValueABCDEFive ASCII bytes

A binary or BCD length prefix is a different representation. Confirm the length encoding and whether the implementation counts bytes or nibbles before calculating the next field’s offset.

Fixed fields have no length prefix

Field 11 uses six ASCII bytes in both starter profiles. The value 000123 occupies exactly six bytes. Removing its leading zeros shortens the field and breaks that profile’s framing.

Padding, permitted characters and optional fields are separate decisions. A profile that can encode a value does not establish that a receiving network will accept it.

Read field 11

Use the bitmap to find fields

The primary bitmap has 64 bit positions. Each bit identifies whether its corresponding field is present. A secondary bitmap extends that range. The bitmap representation and any transport header must be agreed before parsing the data fields.

For field 39, inspect the seventh bit of the fifth primary bitmap byte, counting from the most significant bit. Field 70 is the sixth bit of the first secondary bitmap byte.

The bitmap marks presence. It does not contain a field’s length, value or business result.

Source scope and interpretation

These are configurable starter profiles. Field labels, containers and lengths describe the selected profile, not a universal network contract or a complete code list.