Вот тут: https://gitlab.com/Niklan/dlog/blob/master/web/modules/custom/dlog_comments/src/Service/LetterAvatar.php#L49
в случае с кириллицей в именах, наверное, лучше так
$letter .= mb_substr($username_part, 0, 1);