Truncates a string to ensure its UTF-8 byte representation does not exceed maxBytes.
The truncated string, or the original string if it's within the byte limit.
The string to limit.
The maximum allowed byte length.