Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Current »

Overview

FIX Antenna products fully support UTF-8 encoding.

UTF-8 supports all the CJK (Chinese-Japanese-Korean) symbols but has no other meanings for 0x01 instead of SOH.

FIX-Protocol and non-ASCII characters

The support of non-ASCII characters was introduced in FIX-protocol since FIX 4.2 (https://www.fixtrading.org/standards/fix-4-2/).

The usage of the multibyte encodings is covered by FIX protocol with the followed algorithm:

  1. Special Encoded fields are added for work with Non-ASCII symbols. 
  2. The field MessageEncoding(347) should be specified with the encoding which is used in the other  Encoded* fields of the message.
  3. The length fields (Encoded*Len) should contain the count of BYTES (Important: not count of symbols) contained in corresponding Encoded* field.


However, one can use UTF-8 in any text field. In order to keep FIX-protocol compatibility the counterparty must also expect UTF-8 encoding in the fields.

In case if UTF-16 or UTF-32 are used, the described approach leads to protocol violation because the 0x01 symbol in these encodings would be used inappropriately.

Work with Encoded fields

FIX Antenna and FIXEdge support and correctly processes Encoded fields and UTF-8 in non-encoded fields.

For FIX Antenna, it is user responsibility to convert the Unicode string with UTF-8 content to the UTF-8 string and vice-versa.
The list of encoded tags

Example

The example shows how to work with tags: EncodedText (355) and EncodedTextLen (354) encoded by  MessageEncoding (347)


Field nameField numberField value
MessageEncoding347Shift_JIS
EncodedTextLen35415
EncodedText355こんにちは

Message example: encoding testing.txt

Doesn't work in FIX Client Simulator


Work with User-defined Encoded Fields

To create a new user-defined field using encoded symbols one should create an extra field for the length of the encoded text in bytes. 

Example

Field nameField numberField value
MessageEncoding347Shift_JIS
EncodedUserFieldLen5035415
EncodedUserField50355こんにちは

The counterparty must also expect the encoding in these fields.

Dictionary configuration example:

additional.xml
        <fielddic>
            <!-- ... -->
			<fielddef tag="50354"  name="EncodedUserFieldLen" type="int"/>
			<fielddef tag="50355"  name="EncodedUserField" type="String"/>
            <!-- ... -->
        </fielddic> 


		<msgdic>
            <!-- ... -->
            <msgdef msgtype="B" name="NEWS">
               <!-- ... -->
               <field tag="50354"  name="EncodedUserFieldLen" condreq="existtags(T$50355)"/>
               <field tag="50355"  name="EncodedUserField" condreq="existtags(T$50354)"/>
            </msgdef>
            <!-- ... -->
        </msgdic>

Message example: encoding-testing-custom.txt

FIX Protocol and UTF-16/UTF-32 Encoding

In UTF-16 or UTF-32 encodings, 0x01 is a page code and can be contained in the field content it makes UTF-16 incompatible with FIX-Protocol.

There is no need to use UTF-16 or UTF-32 while it can be replaced with UTF-8

  • No labels