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

index 66d141a6fc461f407739dd3be668bdce7df24863..088f79520e3020d667a28ceb4d8e7278d6115611 100644 (file)
--- 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 
index 282ccf57edba859a274bd5b3eb13e8e9fe39148f..b671b314db454f5fc35baa876ca1160e79246e4a 100644 (file)
@@ -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 {