]> git.mjollnir.org Git - s9y.git/commitdiff
Fix iconv bug, thanks to Matthias Leise
authorgarvinhicking <garvinhicking>
Sat, 5 Aug 2006 20:59:00 +0000 (20:59 +0000)
committergarvinhicking <garvinhicking>
Sat, 5 Aug 2006 20:59:00 +0000 (20:59 +0000)
docs/NEWS
include/functions.inc.php

index dfce7e233d6b0a5b66a434916bc44186b84082d3..be261797f1ce763c1e5b0a07d842d094b40535ca 100644 (file)
--- 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 
index 772ae7b1d8b06735f1e9e6cb2744ffb7ce3b2e81..c0d634ed4528f69c47e458fc718c5059a70c7030 100644 (file)
@@ -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 {