UTF-8 string delimiter

前端 未结 3 1306
悲&欢浪女
悲&欢浪女 2021-01-21 00:30

I am parsing a binary protocol which has UTF-8 strings interspersed among raw bytes. This particular protocol prefaces each UTF-8 string with a short (two bytes) indicating the

3条回答
  •  误落风尘
    2021-01-21 01:08

    I wouldn't call that delimiting, more like "length prefixing". Some people call them Pascal strings since in the early days the language Pascal was one of the popular ones that stored strings that way in memory.

    I don't think there's a formal standard specifically for just that, as it's a rather obvious way of storing UTF-8 strings (or any strings of bytes for that matter). It's defined over and over as a part of many standards that deal with messages that contain strings, though.

提交回复
热议问题