The Lab

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

SBE

Why does the wire representation of a message appear different to that defined in the schema?

When directly inspecting "on-the-wire" representations of char datatypes - including enumerations which may take numeric values - be aware that these are subject to UTF-8 encoding, and you may be inspecting the decimal code of the given character.

Refer to https://en.wikipedia.org/wiki/UTF-8#Codepage_layout for details.

Code Block
languagexml
titleExample
<enum name="Side" description="Side" encodingType="char">
    <validValue name="Buy">1</validValue>
    <validValue name="Sell">2</validValue>
    <validValue name="TwoWay">7</validValue>
</enum>

You may observe the following values:

  • 49 - '1' - Buy
  • 55 - '2' - Sell
  • 55 - '7' - TwoWay

When I parse/write a string from/to a fixed length SBE field, how do I determine/signal where to truncate?

...