...
This compliant solution reads all the desired bytes into its buffer, accounting for the total number of bytes read and adjusting the remaining bytes' offset, consequently ensuring that the required data are read in full. It also avoids splitting multibyte encoded characters across buffers by deferring construction of the result string until the data has been fully read, see IDS13IDS11-J. Do not assume every character in a string is the same size for more information.
...