> ## Documentation Index
> Fetch the complete documentation index at: https://iso8583sim.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# WireFormat

> Wire formats: how an ISO 8583 message is laid out as bytes on the network.

`iso8583sim.wire.format`

## `Encoding`

Bases: `Enum`

How characters and digits are represented on the wire.

| Member | Value |
| - | - |

\| `ASCII` | `'ascii'` |
\| `EBCDIC` | `'ebcdic'` |
\| `BCD` | `'bcd'` |
\| `BINARY` | `'binary'` |

## `WireFormat`

```python theme={null}
WireFormat(
    mti: Encoding = Encoding.ASCII,
    bitmap: str = 'binary',
    length_prefix: Encoding = Encoding.ASCII,
    numeric: Encoding = Encoding.ASCII,
    text: Encoding = Encoding.ASCII,
    binary_fields: str = 'raw',
    ebcdic_codec: str = 'cp037',
    bcd_odd_padding: str = 'left',
)
```

Byte layout of a message. Each part of the message can be encoded independently.

**Attributes**

<ResponseField name="mti" type="Encoding">
  MTI encoding: ASCII, EBCDIC or BCD
</ResponseField>

<ResponseField name="bitmap" type="str">
  "binary" for 8 raw bytes per bitmap, or "hex" for 16 hex characters in
  the text encoding
</ResponseField>

<ResponseField name="length_prefix" type="Encoding">
  Encoding of LLVAR / LLLVAR length indicators: ASCII, EBCDIC, BCD or BINARY
</ResponseField>

<ResponseField name="numeric" type="Encoding">
  Encoding of numeric field content: ASCII, EBCDIC or BCD
</ResponseField>

<ResponseField name="text" type="Encoding">
  Encoding of alphanumeric content: ASCII or EBCDIC
</ResponseField>

<ResponseField name="binary_fields" type="str">
  "raw" to send binary fields (PIN block, MAC, EMV) as bytes, or "hex"
  to send them as hex characters in the text encoding
</ResponseField>

<ResponseField name="ebcdic_codec" type="str">
  Python codec used for EBCDIC (cp037 is US/Canada, cp500 international)
</ResponseField>

<ResponseField name="bcd_odd_padding" type="str">
  Filler nibble position for odd-length variable BCD fields
</ResponseField>

### `ascii_hex()`

```python theme={null}
def ascii_hex() -> WireFormat
```

Everything as ASCII text with a hex bitmap: the byte form of this library's string messages.

### `ascii_binary()`

```python theme={null}
def ascii_binary() -> WireFormat
```

ASCII text and numbers with a binary bitmap and raw binary fields. A common host format.

### `bcd()`

```python theme={null}
def bcd() -> WireFormat
```

BCD MTI, numbers and lengths, binary bitmap, ASCII text. Typical of POS terminal links.

### `ebcdic()`

```python theme={null}
def ebcdic() -> WireFormat
```

EBCDIC text and numbers with a binary bitmap. Used by IBM mainframe hosts.

### `preset()`

```python theme={null}
def preset(name: str) -> WireFormat
```

Look up a preset by name: ascii-hex, ascii-binary, bcd or ebcdic.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.