Bit Octet and Character Strings

The encoding of values of string types can be both primitive or constructed depending on the choice of the encoder. In a primitive encoding of a string, the octets simply represents the elements of strings, if they are octets or characters; or 8-tuples of bits for bit string type padded right by zeroes (information about padding is held in the very first byte). The character of a character string are represented using the set of codes according to defined type.

are encoded as follows:

In a constructed encoding of a string each nested encoding is encoding of string values representing some segment of the overall string. The lengths and boundaries are chosen by encoder and have no semantic significance. The overall string can be then recovered by concatenating these segments in order. This allows indefinite length usage, which can be useful, e.g. if the string is sent sooner as its length is known. The only difference here appears for constructed encoding of character strings, where segments are no longet transmitted as character strings but octet strings.