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.
mask BIT STRING ::= '001110111011'B
os3 OCTET STRING ::= '0AE1C'H
text IA5Sring ::= '...'!!!
are encoded as follows:
03 03 04 3B B0
04 03 0A E1 C0
16 ...!!!
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.