diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-21 10:32:46 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-02-21 12:40:16 +0100 |
commit | f1568b96ce42410f5631ef765ce035ead5d4ce68 (patch) | |
tree | 0915a6bc3d5fbee5c05de95aeeeb51d49a6c5645 /lib | |
parent | a3de507b7626919a42ef6a86d94af30b0f04f3a9 (diff) | |
download | nextcloud-server-f1568b96ce42410f5631ef765ce035ead5d4ce68.tar.gz nextcloud-server-f1568b96ce42410f5631ef765ce035ead5d4ce68.zip |
Use mb_* string methods to extract first character for generated avatars
This fixes #8451 where the first character is a non-ASCII character. The `$string[0]` notation only extracted one byte and thus resulting in an invalid code. The `mb_strtoupper` method also allows to convert characters independently from the current locale on the server.
See also http://php.net/manual/en/function.mb-strtoupper.php
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Avatar.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/private/Avatar.php b/lib/private/Avatar.php index 45ad66d0817..863d27a8747 100644 --- a/lib/private/Avatar.php +++ b/lib/private/Avatar.php @@ -246,7 +246,7 @@ class Avatar implements IAvatar { * @return string */ private function generateAvatar($userDisplayName, $size) { - $text = strtoupper(substr($userDisplayName, 0, 1)); + $text = mb_strtoupper(mb_substr($userDisplayName, 0, 1), 'UTF-8'); $backgroundColor = $this->avatarBackgroundColor($userDisplayName); $im = imagecreatetruecolor($size, $size); |