Skip to main content
Real hosts exchange bytes, often with a binary bitmap, packed BCD numbers or EBCDIC text. iso8583sim.wire converts between the two.
Decoded messages have the same field values the string parser gives, so validation, explain, conversion and the rest work on them unchanged. The same functions are available directly as iso8583sim.wire.encode_message and decode_message.

Presets

WireFormat.preset("bcd") looks a preset up by name.

Custom formats

Every part is configurable:
Rules worth knowing:
  • BCD packs two digits per byte. An LLVAR BCD length is one byte, an LLLVAR length two bytes. The length counts digits, not bytes.
  • Odd digit counts need a filler nibble. Fixed numeric fields always get a leading 0. For variable fields, networks differ, so bcd_odd_padding chooses a leading 0 or a trailing F.
  • Track 2 (field 35) uses = as a separator, which BCD writes as the nibble D.
  • Content types. Fields 2, 32, 33, 99 and 100 are numeric, fields 35 and 36 are track data, and field 55 (EMV) is binary. Other variable fields are text.

Accuracy

The encodings are tested against the independent pyiso8583 library configured the same way, and every preset round-trips every field type. Length headers and TPDUs for sending over TCP are covered separately.