Compartir a través de


2.1.3 Length-Prefixed UTF-8 String (UTF-8-LP-P4)

The Length-Prefixed UTF-8 String structure (UTF-8-LP-P4) contains a length-prefixed UTF-8 string, padded to use a multiple of 4 bytes.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Length

Data (variable)

...

Padding (variable)

...

Length (4 bytes): An unsigned integer that specifies the size, in bytes, of the Data field.

Data (variable): A UTF-8 string that specifies the value of the UTF-8-LP-P4 structure. It MUST NOT be null-terminated.

Padding (variable): A set of bytes that MUST be of correct size such that the size of the UTF-8-LP-P4 structure is a multiple of 4 bytes. If Padding is present, each byte MUST be 0x00. If the value of the Length field is exactly 0x00000000, the Data field specifies a null string, and the entire structure uses exactly 4 bytes. If the value of the Length field is exactly 0x00000004, the Data field specifies an empty string, and the entire structure also uses exactly 4 bytes.