From 64af0896fa68ed02a731d739a96a1f1855aad709 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Sat, 5 Aug 2006 20:59:20 +0000 Subject: [PATCH] Fix iconv bug, thanks to Matthias Leise --- docs/NEWS | 3 +++ include/functions.inc.php | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/NEWS b/docs/NEWS index 66d141a..088f795 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.0.1 () ------------------------------------------------------------------------ + * Fix utf8 iconv conversion failing on some older PHP setups. + Thanks to Matthias Leisi! + * Fix multi-authors view only showing first author (garvinhicking) * Fix bug sending comment-notification mails to subscribed users diff --git a/include/functions.inc.php b/include/functions.inc.php index 282ccf5..b671b31 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -480,7 +480,12 @@ function serendipity_fetchReferences($id) { function serendipity_utf8_encode($string) { if (strtolower(LANG_CHARSET) != 'utf-8') { if (function_exists('iconv')) { - return iconv(LANG_CHARSET, 'UTF-8', $string); + $new = iconv(LANG_CHARSET, 'UTF-8', $string); + if ($new !== false) { + return $new; + } else { + return utf8_encode($string); + } } else if (function_exists('mb_convert_encoding')) { return mb_convert_encoding($string, 'UTF-8', LANG_CHARSET); } else { -- 2.39.5