Merge pull request #6341 from MrPetovan/bug/parseurl-charset

Replace latin-1 by latin1 in charset detection
This commit is contained in:
Michael Vogel 2018-12-29 11:00:06 +01:00 committed by GitHub
commit bf1f164ece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -182,11 +182,10 @@ class ParseUrl
$charset = trim(trim(trim(array_pop($matches)), ';,'));
}
if ($charset == '') {
$charset = 'utf-8';
}
if ($charset && strtoupper($charset) != 'UTF-8') {
// See https://github.com/friendica/friendica/issues/5470#issuecomment-418351211
$charset = str_ireplace('latin-1', 'latin1', $charset);
if (($charset != '') && (strtoupper($charset) != 'UTF-8')) {
Logger::log('detected charset ' . $charset, Logger::DEBUG);
$body = iconv($charset, 'UTF-8//TRANSLIT', $body);
}