All String values are encoded as a sequence of UTF-8 characters preceded by the length in bytes.
The length in bytes is encoded as Int32. A value of −1 is used to indicate a ‘null’ string.
Strings with embedded nulls (‘\0’) are not guaranteed to be interoperable because not all DevelopmentPlatforms can handle Strings with embedded nulls. For this reason, embedded nulls are not recommended. Encoders may encode Strings with embedded nulls. Decoders shall use the length to read all bytes in String, however decoders may truncate the String at the first embedded null before passing it on to the application.
Figure 4 illustrates how the multilingual string ‘水Boy’ is encoded in a byte stream.