Replace latin-1 by latin1 in charset detection

- Simplify conditional for charset conversion
This commit is contained in:
Hypolite Petovan 2018-09-04 10:52:17 -04:00
parent 16f58c8982
commit 37c7a18d00

View file

@ -182,11 +182,10 @@ class ParseUrl
$charset = trim(trim(trim(array_pop($matches)), ';,')); $charset = trim(trim(trim(array_pop($matches)), ';,'));
} }
if ($charset == '') { if ($charset && strtoupper($charset) != 'UTF-8') {
$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); Logger::log('detected charset ' . $charset, Logger::DEBUG);
$body = iconv($charset, 'UTF-8//TRANSLIT', $body); $body = iconv($charset, 'UTF-8//TRANSLIT', $body);
} }