Truncates a UTF-8-encoded string safely to a number of bytes.
string $string: The string to truncate.
int $len: An upper limit on the returned string length.
string The truncated string.
\Drupal\Component\Utility\Unicode::truncateBytes().
function drupal_truncate_bytes($string, $len) {
return Unicode::truncateBytes($string, $len);
}