string

A basic bare type. Values of type string look differently depending on the length L of the string being serialized:

  • If L <= 253, the serialization contains one byte with the value of L, then L bytes of the string followed by 0 to 3 characters containing 0, such that the overall length of the value be divisible by 4, whereupon all of this is interpreted as a sequence of int(L/4)+1 32-bit little-endian integers.
  • If L >= 254, the serialization contains byte 254, followed by 3 bytes with the string length L in little-endian order, followed by L bytes of the string, further followed by 0 to 3 null padding bytes.

All strings passed to the API must be encoded in UTF-8. When arbitrary byte sequences have to be serialized, bytes alias is to be used.

Further details on basic types»