Search code examples
utf-8telegrammtproto

MTProto string type: are lengths measured in bytes or UTF-8 string length?


Looking at https://core.telegram.org/type/string it's unclear to me whether the length discussed here is the UTF-8 string length, or the number of bytes the string has been encoded into.


Solution

  • On second reading it seems that it is the number of bytes:

    then L bytes of the string followed by 0 to 3 characters containing 0