Steps to reproduce
- Login to web interface.
- Go to own Settings → Personal info.
- If graphical avatar is not supplied, first initial of display name is used.
- If it happens to be in Unicode, as in e.g. 'Šarūnas', incorrect symbol is shown in avatar image.
Expected behaviour
A correct symbol from UTF-8 should be rendered in PNG.
Actual behaviour
lib/private/Avatar.php uses imagettftext(), which expects text in UTF-8. However initial symbol from display name is retrieved using substr()
$text = strtoupper(substr($userDisplayName, 0, 1))
which only gets the first part of the Unicode symbol, resulting in incorrect letter. Instead mb_substr() should be used, i.e.:
$text = strtoupper(mb_substr($userDisplayName, 0, 1))
Server configuration
Operating system: Ubuntu 16.04.3
Web server: Apache 2.4
Database: MySQL
PHP version: 7.0.22-0ubuntu0.16.04.1
Nextcloud version: 13.0.0
Steps to reproduce
Expected behaviour
A correct symbol from UTF-8 should be rendered in PNG.
Actual behaviour
lib/private/Avatar.php uses imagettftext(), which expects text in UTF-8. However initial symbol from display name is retrieved using substr()
$text = strtoupper(substr($userDisplayName, 0, 1))
which only gets the first part of the Unicode symbol, resulting in incorrect letter. Instead mb_substr() should be used, i.e.:
$text = strtoupper(mb_substr($userDisplayName, 0, 1))
Server configuration
Operating system: Ubuntu 16.04.3
Web server: Apache 2.4
Database: MySQL
PHP version: 7.0.22-0ubuntu0.16.04.1
Nextcloud version: 13.0.0