]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/include/main.inc
Imported Upstream version 0.2.2
[roundcube.git] / program / include / main.inc
index c8bd137c4796b25e56eee400a9605efff2e5ae98..4c6ddffb272f764ef910c769af61dcbc4258c944 100644 (file)
@@ -15,7 +15,7 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: main.inc 2321 2009-03-01 08:14:14Z alec $
+ $Id: main.inc 2483 2009-05-15 10:22:29Z thomasb $
 
 */
 
@@ -188,7 +188,7 @@ function rcube_charset_convert($str, $from, $to=NULL)
   if ($to == 'UNICODE-1-1-UTF-7')
     $to = 'UTF-7';
 
-  if ($from==$to || $str=='' || empty($from))
+  if ($from == $to || empty($str) || empty($from))
     return $str;
     
   $aliases = array(
@@ -242,6 +242,8 @@ function rcube_charset_convert($str, $from, $to=NULL)
   if ($from == 'UTF-7') {
     if ($_str = utf7_to_utf8($str))
       $str = $_str;
+    else
+      $error = true;
   }
   else if (($from == 'ISO-8859-1') && function_exists('utf8_encode')) {
     $str = utf8_encode($str);
@@ -250,7 +252,7 @@ function rcube_charset_convert($str, $from, $to=NULL)
     $conv->loadCharset($from);
     $str = $conv->strToUtf8($str);
   }
-  else if ($from != 'UTF-8') {}
+  else if ($from != 'UTF-8')
     $error = true;
 
   // encode string for output
@@ -274,7 +276,7 @@ function rcube_charset_convert($str, $from, $to=NULL)
       'code' => 500,
       'type' => 'php',
       'file' => __FILE__,
-      'message' => "Could not convert string charset. Make sure iconv is installed or lib/utf8.class is available"
+      'message' => "Could not convert string from $from to $to. Make sure iconv is installed or lib/utf8.class is available"
       ), true, false);
     
     $convert_warning = true;