You could use a variable-width size field similar to how UTF-8 works, but that's getting pretty complicated and inefficient.
e.x.
0xxx xxxx
10xx xxxx xxxx xxxx
110x xxxx xxxx xxxx xxxx xxxx
1110 xxxx xxxx xxxx xxxx xxxx xxxx xxxx
etc
e.x.
0xxx xxxx
10xx xxxx xxxx xxxx
110x xxxx xxxx xxxx xxxx xxxx
1110 xxxx xxxx xxxx xxxx xxxx xxxx xxxx
etc
The use of "magic" characters is not the problem, as I see it.
BTW I'm not sure if it was clear or not but those are bits in my diagram, not bytes/characters. The "x"s are the bits of the length field, not the characters of the string.
But does that really matter when you're doing operations on the string that iterate over the whole string anyway? Since iterating the whole string is O(n) anyway, you're not really gaining anything.
You also have a fair idea of a reasonable sized buffer to move in duplication operations, avoiding single character move loops.