From 717022a81d205a06cd409d2874eeefcb33180b00 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Sat, 5 Aug 2006 20:59:00 +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 dfce7e23..be261797 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -241,6 +241,9 @@ Version 1.1-alpha5() 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 772ae7b1..c0d634ed 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -537,7 +537,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 {