Fix warning if the encoding retrieved from external headers is invalid

Also fixed the regex to support this failing header: charset="utf-8"\r\n"
This commit is contained in:
ArthurHoaro 2020-09-26 13:28:38 +02:00
parent d0ae1ba273
commit 1ea09a1b8b
3 changed files with 15 additions and 2 deletions
application/front/controller/admin

View file

@ -69,7 +69,7 @@ class ManageShaareController extends ShaarliAdminController
$retrieveDescription
)
);
if (! empty($title) && strtolower($charset) !== 'utf-8') {
if (! empty($title) && strtolower($charset) !== 'utf-8' && mb_check_encoding($charset)) {
$title = mb_convert_encoding($title, 'utf-8', $charset);
}
}