The Photoshop file format documentation mentions Pascal strings without explaining what they are.
So, what are they, and how are they encoded?
A Pascal-style string has one leading byte (length
), followed by length
bytes of character data.
This means that Pascal-style strings can only encode strings of between 0 and 255 characters in length (assuming single-byte character encodings such as ASCII).
As an aside, another popular string encoding is C-style strings which have no length specifier, but use a zero-byte to denote the end of the string. They therefore have no length limit.
Yet other encodings may use a greater number of prefix bytes to facilitate longer strings. Terminator bytes/sentinels may also be used along with length prefixes.