Using DataFieldFrameLength with string RRS feed

  • Question

  • hello,

    I am trying to parse a utf-8 string preceded by 1 byte specifying the length by defining a struct


    UINT8 Length;

    【DataFieldFrameLength = Length]

    String(2) Text; // utf-8 string, not null terminated


    it compiles ok, but the field Text is never consumed, while BLOB(Length) works.

    Since the text is a utf-8 string, i cannot find other ways to limit its binary size to a specified value without using this property, ant it does not seem to work as expected.


    Saturday, August 27, 2011 2:44 PM

All replies

  • Can you use the length parameter for String to limit the length.



      UINT8 Length;

      String(2, Length) Text;



    • Proposed as answer by Paul E Long Wednesday, September 7, 2011 1:51 PM
    Monday, August 29, 2011 3:11 PM
  • According to the doc, the length passed to String is the number of chars to be consumed, not the size of input data.

    Thursday, September 1, 2011 1:41 AM
  • That is right.  You can specifiy other character types which change the actual size of the input data that is consumed.

    Are you able to consume the data properly now?


    Wednesday, September 7, 2011 1:51 PM