Because that way we don't limit what can be in the string. The alternative is to use some sort of in-band signaling of the end of the string, like C's \0, which either means you can't have some kinds of data in it, or that you have to deal with quoting of some sort. Prefix lengths are much easier to work with and less error-prone.
Because that way we don't limit what can be in the string. The alternative is to use some sort of in-band signaling of the end of the string, like C's
\0
, which either means you can't have some kinds of data in it, or that you have to deal with quoting of some sort. Prefix lengths are much easier to work with and less error-prone.