Menu

#17 Bug in raw data encoding

open
nobody
None
5
2009-11-06
2009-11-06
No

From the spec:

data: Raw data with no format or content restrictions. Data fields are always immediately
preceded by a length field. The length field should specify the number of bytes of the value of
the data field (up to but not including the terminating SOH). Caution: the value of one of
these fields may contain the delimiter (SOH) character. Note that the value specified for this
field should be followed by the delimiter (SOH) character as all fields are terminated with an
“SOH”.

It seems that raw data fields may not be encoded according to the spec:

#!/usr/bin/python

import quickfix42
import quickfix

message = quickfix42.Logon()

rawData = "TEST\x01XXX"

length = quickfix.SignatureLength(len(rawData))
sig = quickfix.Signature(rawData)

message.getTrailer().setField(length)
message.getTrailer().setField(sig)

buf = message.toString()
print `buf`

Output:
'8=FIX.4.2\x019=22\x0135=A\x0189=TEST\x01XXX\x0193=8\x0110=187\x01'

Note that tag 93=8 (signature length) is encoded *after* tag=89 (signature data).

Discussion


Log in to post a comment.