I once had to decode an ASCII based datastream that was encoded something like this:
* the first 14 characters were the length of the data stream in ASCII, padded with 0
* after this came the records - each record started with the size of the record, including the record header
* the record then had each field start with a letter that indicated what sort of record it was - integer, float, character, variable string - all were encoded in ASCII
* variable records were the letter "V", then a 14 byte length
Yes, the format was awful. But you asked when that would be useful. There's your answer.
You could still do this even if strings were encoded in UTF-8. Just define the length of the record to be the length in bytes.
This is why most modern programming & serialization languages (Go, Python 3, Protocol Buffers, Cap'n Proto) define separate byte[] and string types. Some things are just binary data and should be treated as such. Other things are encodings of world languages and should also be treated as such.
* the first 14 characters were the length of the data stream in ASCII, padded with 0
* after this came the records - each record started with the size of the record, including the record header
* the record then had each field start with a letter that indicated what sort of record it was - integer, float, character, variable string - all were encoded in ASCII
* variable records were the letter "V", then a 14 byte length
Yes, the format was awful. But you asked when that would be useful. There's your answer.