Require to pass target charset to convertCharset().
authorJan Schneider <jan@horde.org>
Sun, 3 Oct 2010 17:35:19 +0000 (19:35 +0200)
committerJan Schneider <jan@horde.org>
Sun, 3 Oct 2010 17:52:15 +0000 (19:52 +0200)
48 files changed:
agora/lib/Messages.php
agora/scripts/phorum2agora.php
ansel/lib/Image.php
ansel/lib/Storage.php
fima/lib/Driver/sql.php
framework/Alarm/lib/Horde/Alarm/Sql.php
framework/Core/lib/Horde/Config.php
framework/Core/lib/Horde/Core/Factory/Prefs.php
framework/Crypt/lib/Horde/Crypt/Pgp.php
framework/DataTree/DataTree.php
framework/DataTree/DataTree/sql.php
framework/Icalendar/lib/Horde/Icalendar.php
framework/Kolab/Kolab.php
framework/Mime/lib/Horde/Mime/Headers.php
framework/Mime_Viewer/lib/Horde/Mime/Viewer/Enriched.php
framework/Mime_Viewer/lib/Horde/Mime/Viewer/Html.php
framework/Mime_Viewer/lib/Horde/Mime/Viewer/Plain.php
framework/Mime_Viewer/lib/Horde/Mime/Viewer/Richtext.php
framework/Prefs/lib/Horde/Prefs.php
framework/Rampage/scripts/Horde/Rampage/rampage.php
framework/Share/lib/Horde/Share/Sql.php
framework/Text_Filter/lib/Horde/Text/Filter/Cleanhtml.php
framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php
framework/Util/lib/Horde/String.php
hermes/entry.php
hermes/lib/Application.php
horde/admin/sqlshell.php
imp/config/hooks.php.dist
imp/config/prefs.php.dist
imp/folders.php
imp/lib/Compose.php
imp/lib/Contents.php
imp/lib/IMP.php
imp/lib/Imap/Flags.php
imp/lib/Mime/Viewer/Plain.php
imp/view.php
ingo/lib/Storage/Filters/Sql.php
ingo/lib/Storage/Sql.php
jonah/lib/Driver/Sql.php
kronolith/lib/Driver/Sql.php
mnemo/lib/Driver/sql.php
nag/lib/Driver/Sql.php
trean/lib/Bookmarks.php
turba/lib/Driver/Ldap.php
turba/lib/Driver/Sql.php
whups/lib/Driver/sql.php
whups/lib/Mail.php
wicked/lib/Driver/sql.php

index fb9e436..920fffc 100644 (file)
@@ -2210,7 +2210,7 @@ class Agora_Messages {
      */
     public function convertFromDriver($value)
     {
-        return Horde_String::convertCharset($value, $this->_params['charset']);
+        return Horde_String::convertCharset($value, $this->_params['charset'], 'UTF-8');
     }
 
     /**
index 8f0ae2b..f1343ed 100755 (executable)
@@ -119,8 +119,8 @@ foreach ($messages as $message) {
     $params[] = makeParents($message['thread'], $message['message_id']);
     $params[] = ($message['thread'] == $message['message_id']) ? 0 : $message['thread'];
     $params[] = $message['author'];
-    $params[] = Horde_String::convertCharset($message['subject'], $conf['sql']['charset']);
-    $params[] = Horde_String::convertCharset($message['body'], $conf['sql']['charset']);
+    $params[] = Horde_String::convertCharset($message['subject'], $conf['sql']['charset'], 'UTF-8');
+    $params[] = Horde_String::convertCharset($message['body'], $conf['sql']['charset'], 'UTF-8');
     $params[] = $message['datestamp'];
     $params[] = 0;
     $params[] = $message['ip'];
index f97d502..2e780df 100644 (file)
@@ -1201,7 +1201,7 @@ class Ansel_Image Implements Iterator
             if (!isset($attributes[$field])) {
                 continue;
             }
-            $value = Horde_Image_Exif::getHumanReadable($field, Horde_String::convertCharset($attributes[$field], $GLOBALS['conf']['sql']['charset']));
+            $value = Horde_Image_Exif::getHumanReadable($field, Horde_String::convertCharset($attributes[$field], $GLOBALS['conf']['sql']['charset'], 'UTF-8'));
             if (!$format) {
                 $output[$field] = $value;
             } else {
index 1488751..3404f7f 100644 (file)
@@ -470,8 +470,8 @@ class Ansel_Storage
             Horde::logMessage($image, 'ERR');
             throw new Ansel_Exception($image);
         } else {
-            $image['image_filename'] = Horde_String::convertCharset($image['image_filename'], $GLOBALS['conf']['sql']['charset']);
-            $image['image_caption'] = Horde_String::convertCharset($image['image_caption'], $GLOBALS['conf']['sql']['charset']);
+            $image['image_filename'] = Horde_String::convertCharset($image['image_filename'], $GLOBALS['conf']['sql']['charset'], 'UTF-8');
+            $image['image_caption'] = Horde_String::convertCharset($image['image_caption'], $GLOBALS['conf']['sql']['charset'], 'UTF-8');
             $this->_images[$id] = new Ansel_Image($image);
 
             return $this->_images[$id];
@@ -626,8 +626,8 @@ class Ansel_Storage
 
         $return = array();
         while ($image = $images->fetchRow(MDB2_FETCHMODE_ASSOC)) {
-            $image['image_filename'] = Horde_String::convertCharset($image['image_filename'], $GLOBALS['conf']['sql']['charset']);
-            $image['image_caption'] = Horde_String::convertCharset($image['image_caption'], $GLOBALS['conf']['sql']['charset']);
+            $image['image_filename'] = Horde_String::convertCharset($image['image_filename'], $GLOBALS['conf']['sql']['charset'], 'UTF-8'
+            $image['image_caption'] = Horde_String::convertCharset($image['image_caption'], $GLOBALS['conf']['sql']['charset'], 'UTF-8');
             $return[$image['image_id']] = new Ansel_Image($image);
             $this->_images[(int)$image['image_id']] = &$return[$image['image_id']];
         }
@@ -730,8 +730,8 @@ class Ansel_Storage
         }
 
         while ($image = $images->fetchRow(MDB2_FETCHMODE_ASSOC)) {
-            $image['image_filename'] = Horde_String::convertCharset($image['image_filename'], $GLOBALS['conf']['sql']['charset']);
-            $image['image_caption'] = Horde_String::convertCharset($image['image_caption'], $GLOBALS['conf']['sql']['charset']);
+            $image['image_filename'] = Horde_String::convertCharset($image['image_filename'], $GLOBALS['conf']['sql']['charset'], 'UTF-8');
+            $image['image_caption'] = Horde_String::convertCharset($image['image_caption'], $GLOBALS['conf']['sql']['charset'], 'UTF-8');
             $results[] = new Ansel_Image($image);
         }
         $images->free();
index 6d8fe3c..e473c98 100644 (file)
@@ -494,13 +494,13 @@ class Fima_Driver_sql extends Fima_Driver {
                      'owner' => $row['account_owner'],
                      'number' => sprintf('%\'04d', $row['account_number']),
                      'type' => $row['account_type'],
-                     'name' => Horde_String::convertCharset($row['account_name'], $this->_params['charset']),
+                     'name' => Horde_String::convertCharset($row['account_name'], $this->_params['charset'], 'UTF-8'),
                      'eo' => $row['account_eo'],
-                     'desc' => Horde_String::convertCharset($row['account_desc'], $this->_params['charset']),
+                     'desc' => Horde_String::convertCharset($row['account_desc'], $this->_params['charset'], 'UTF-8'),
                      'closed' => $row['account_closed'],
                      'label' => trim($row['account_number'] . ' ' .
                                 (($parent === null) ? '' : $parent['name'] . ' - ') .
-                                Horde_String::convertCharset($row['account_name'], $this->_params['charset'])),
+                                Horde_String::convertCharset($row['account_name'], $this->_params['charset'], 'UTF-8')),
                      'parent_id' => ($parent === null) ? null : $parent['account_id'],
                      'parent_number' => ($parent === null) ? '' : $parent['number'],
                      'parent_name' => ($parent === null) ? '' : $parent['name']);
@@ -686,7 +686,7 @@ class Fima_Driver_sql extends Fima_Driver {
                      'date' => $row['posting_date'],
                      'asset' => $row['posting_asset'],
                      'account' => $row['posting_account'],
-                     'desc' => Horde_String::convertCharset($row['posting_desc'], $this->_params['charset']),
+                     'desc' => Horde_String::convertCharset($row['posting_desc'], $this->_params['charset'], 'UTF-8'),
                      'amount' => $row['posting_amount'],
                      'eo' => (int)(bool)$row['posting_eo']);
     }
index aabe49b..6a7cb64 100644 (file)
@@ -407,7 +407,7 @@ class Horde_Alarm_Sql extends Horde_Alarm
      */
     protected function _fromDriver($value)
     {
-        return Horde_String::convertCharset($value, $this->_params['charset']);
+        return Horde_String::convertCharset($value, $this->_params['charset'], 'UTF-8');
     }
 
     /**
index f303a26..fe87ed5 100644 (file)
@@ -1411,10 +1411,6 @@ class Horde_Config
             $ptr = $ptr[$ctx[$i]];
         }
 
-        if (is_string($ptr)) {
-            $ptr = Horde_String::convertCharset($ptr, 'iso-8859-1');
-        }
-
         return array($ptr, false);
     }
 
@@ -1604,7 +1600,7 @@ class Horde_Config
             return $apps;
 
         case 'list-horde-languages':
-            return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . 'UTF-8' . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . 'UTF-8' . '\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']);
+            return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"UTF-8\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"UTF-8\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']);
 
         case 'list-blocks':
             $collection = Horde_Block_Collection::singleton();
index 677426f..18e26db 100644 (file)
@@ -81,7 +81,6 @@ class Horde_Core_Factory_Prefs
             'logger' => $this->_injector->getInstance('Horde_Log_Logger'),
             'password' => '',
             'sizecallback' => ((isset($GLOBALS['conf']['prefs']['maxsize'])) ? array($this, 'sizeCallback') : null),
-            'uicharset' => 'UTF-8',
             'user' => ''
         ), $opts);
         ksort($opts);
index 2f01351..59608d3 100644 (file)
@@ -947,7 +947,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt
                     $charset = $lang_charset[1];
                 }
             }
-            throw new Horde_Crypt_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, $charset), $errno));
+            throw new Horde_Crypt_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, $charset, 'UTF-8'), $errno));
         }
     }
 
index 6073e52..742c29a 100644 (file)
@@ -659,7 +659,7 @@ class DataTree {
         $cids = array();
         foreach ($data as $id => $cat) {
             if (!is_null($charset)) {
-                $cat[1] = Horde_String::convertCharset($cat[1], $charset);
+                $cat[1] = Horde_String::convertCharset($cat[1], $charset, 'UTF-8');
             }
             $cids[$cat[0]] = $cat[1];
             $cparents[$cat[0]] = $cat[2];
index aee91f9..c730ee6 100644 (file)
@@ -1018,7 +1018,8 @@ class DataTree_sql extends DataTree {
                 /* Convert old data to the new format. */
                 if ($row[1] == Horde_Serialize::BASIC) {
                     $data[$id] = Horde_String::convertCharset($data[$id],
-                                                              $GLOBALS['registry']->getLanguageCharset());
+                                                              $GLOBALS['registry']->getLanguageCharset(),
+                                                              'UTF-8');
                 }
 
                 $data[$id] = (is_null($data[$id]) || !is_array($data[$id]))
@@ -1041,7 +1042,7 @@ class DataTree_sql extends DataTree {
                                                  'UTF-8');
             /* Convert old data to the new format. */
             if ($row['datatree_serialized'] == Horde_Serialize::BASIC) {
-                $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getLanguageCharset());
+                $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getLanguageCharset(), 'UTF-8');
             }
             return (is_null($data) || !is_array($data)) ? array() : $data;
         }
@@ -1213,7 +1214,7 @@ class DataTree_sql extends DataTree {
                             return $result;
                         }
                         while ($row = $result->fetchRow()) {
-                            $rows[$row[0]] = Horde_String::convertCharset($row[1], $this->_params['charset']);
+                            $rows[$row[0]] = Horde_String::convertCharset($row[1], $this->_params['charset'], 'UTF-8');
                         }
                     }
 
@@ -1249,7 +1250,7 @@ class DataTree_sql extends DataTree {
 
         $rows = array();
         while ($row = $result->fetchRow()) {
-            $rows[$row[0]] = Horde_String::convertCharset($row[1], $this->_params['charset']);
+            $rows[$row[0]] = Horde_String::convertCharset($row[1], $this->_params['charset'], 'UTF-8');
         }
 
         return $rows;
index 8e67131..f103a57 100644 (file)
@@ -656,10 +656,10 @@ class Horde_Icalendar
 
                     $value = quoted_printable_decode($value);
                     if (isset($params['CHARSET'])) {
-                        $value = Horde_String::convertCharset($value, $params['CHARSET']);
+                        $value = Horde_String::convertCharset($value, $params['CHARSET'], 'UTF-8');
                      }
                 } elseif (isset($params['CHARSET'])) {
-                    $value = Horde_String::convertCharset($value, $params['CHARSET']);
+                    $value = Horde_String::convertCharset($value, $params['CHARSET'], 'UTF-8');
                 }
 
                 // Get timezone info for date fields from $params.
index fd21a3a..14982b9 100644 (file)
@@ -568,7 +568,7 @@ class Kolab {
      */
     function decodeImapFolderName($name)
     {
-        return Horde_String::convertCharset($name, 'UTF7-IMAP');
+        return Horde_String::convertCharset($name, 'UTF7-IMAP', 'UTF-8');
     }
 
     /**
index d538395..3b40b55 100644 (file)
@@ -613,7 +613,7 @@ class Horde_Mime_Headers implements Serializable
                 continue;
             }
             if ($eightbit_check && Horde_Mime::is8bit($val[1])) {
-                $val[1] = Horde_String::convertCharset($val[1], self::$defaultCharset);
+                $val[1] = Horde_String::convertCharset($val[1], self::$defaultCharset, 'UTF-8');
             }
 
             if (in_array(Horde_String::lower($val[0]), $mime)) {
index 954dded..a12afe2 100644 (file)
@@ -60,8 +60,8 @@ class Horde_Mime_Viewer_Enriched extends Horde_Mime_Viewer_Base
     protected function _renderInline()
     {
         return $this->_renderReturn(
-            Horde_String::convertCharset($this->_toHTML(true), $this->_mimepart->getCharset(), $this->getConfigParam('charset')),
-            'text/html; charset=' . $this->getConfigParam('charset')
+            Horde_String::convertCharset($this->_toHTML(true), $this->_mimepart->getCharset(), 'UTF-8'),
+            'text/html; charset=UTF-8'
         );
     }
 
index b8d468f..e5c4938 100644 (file)
@@ -96,8 +96,8 @@ class Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Base
         $html = $this->_cleanHTML($this->_mimepart->getContents(), array('inline' => true));
 
         return $this->_renderReturn(
-            Horde_String::convertCharset($html, $this->_mimepart->getCharset(), $this->getConfigParam('charset')),
-            'type' => 'text/html; charset=' . $this->getConfigParam('charset')
+            Horde_String::convertCharset($html, $this->_mimepart->getCharset(), 'UTF-8'),
+            'type' => 'text/html; charset=UTF-8'
         );
     }
 
index 4dca5d3..83b8c4a 100644 (file)
@@ -61,7 +61,7 @@ class Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Base
      */
     protected function _renderInline()
     {
-        $text = Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset(), $this->getConfigParam('charset'));
+        $text = Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset(), 'UTF-8');
 
         /* Check for 'flowed' text data. */
         $data = ($this->_mimepart->getContentTypeParameter('format') == 'flowed')
@@ -70,7 +70,7 @@ class Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Base
 
         return $this->_renderReturn(
             $data,
-            'text/html; charset=' . $this->getConfigParam('charset')
+            'text/html; charset=UTF-8'
         );
     }
 
index d2122d9..d199092 100644 (file)
@@ -70,8 +70,8 @@ class Horde_Mime_Viewer_Richtext extends Horde_Mime_Viewer_Base
     protected function _renderInline()
     {
         return $this->_renderReturn(
-            Horde_String::convertCharset($this->_toHTML(), $this->_mimepart->getCharset(), $this->getConfigParam('charset')),
-            'text/html; charset=' . $this->getConfigParam('charset')
+            Horde_String::convertCharset($this->_toHTML(), $this->_mimepart->getCharset(), 'UTF-8'),
+            'text/html; charset=UTF-8'
         );
     }
 
index bfab8ab..a653504 100644 (file)
@@ -115,7 +115,6 @@ class Horde_Prefs
      * 'sizecallback' - (callback) If set, called when setting a value in
      *                  the backend.
      *                  DEFAULT: NONE
-     * 'uicharset' - (string) UI charset. [REQUIRED]
      * 'user' - (string) The name of the user who owns this set of
      *          preferences.
      *          DEFAULT: NONE
@@ -154,7 +153,7 @@ class Horde_Prefs
      */
     protected function __construct($scope, $opts, $params)
     {
-        foreach (array('charset', 'uicharset') as $val) {
+        foreach (array('charset') as $val) {
             if (!isset($opts[$val])) {
                 throw new InvalidArgumentException('Missing ' . $val . ' parameter.');
             }
@@ -637,7 +636,7 @@ class Horde_Prefs
     {
         return is_bool($value)
             ? $value
-            : Horde_String::convertCharset($value, $this->getCharset(), $this->_opts['uicharset']);
+            : Horde_String::convertCharset($value, $this->getCharset(), 'UTF-8');
     }
 
     /**
@@ -651,7 +650,7 @@ class Horde_Prefs
     {
         return is_bool($value)
             ? $value
-            : Horde_String::convertCharset($value, $this->_opts['uicharset'], $this->getCharset());
+            : Horde_String::convertCharset($value, 'UTF-8', $this->getCharset());
     }
 
     /**
index 86fa6e3..8f588b8 100644 (file)
@@ -1096,7 +1096,7 @@ function field_sql2php($field)
     case 'mediumtext':
     case 'longblob':
     case 'longtext':
-        return "Horde_String::convertCharset(\$row['".$field["name"]."'], \$this->_params['charset'])";
+        return "Horde_String::convertCharset(\$row['".$field["name"]."'], \$this->_params['charset'], 'UTF-8')";
 
     // Integer types
     case 'bit':
index 06f59ed..1efa1c9 100644 (file)
@@ -896,7 +896,7 @@ class Horde_Share_Sql extends Horde_Share
         foreach ($data as $key => $value) {
             if (substr($key, 0, 9) == 'attribute') {
                 $data[$key] = Horde_String::convertCharset(
-                    $data[$key], $this->_params['charset']);
+                    $data[$key], $this->_params['charset'], 'UTF-8');
             }
         }
 
index 582b610..0f9a393 100644 (file)
@@ -6,8 +6,6 @@
  * <pre>
  * body_only - (boolean) Only return the body data?
  *             DEFAULT: Return the whole HTML document
- * charset - (string) The charset of the text.
- *           DEFAULT: US-ASCII
  * size - (integer) Only filter if data is below this size.
  *        DEFAULT: No default
  * </pre>
index a48dd80..97117d9 100644 (file)
@@ -8,7 +8,6 @@
  *            DOMDocument object and the DOMNode object. If the callback
  *            returns non-null, add this text to the output and skip further
  *            processing of the node.
- * charset - (string) The charset of the text.
  * width - (integer) The wrapping width. Set to 0 to not wrap.
  * </pre>
  *
index b67b5d8..dd2baea 100644 (file)
@@ -53,18 +53,13 @@ class Horde_String
      *
      * @return mixed  The converted input data.
      */
-    static public function convertCharset($input, $from, $to = null, $force = false)
+    static public function convertCharset($input, $from, $to, $force = false)
     {
         /* Don't bother converting numbers. */
         if (is_numeric($input)) {
             return $input;
         }
 
-        /* Get the user's default character set if none passed in. */
-        if (is_null($to)) {
-            $to = self::$_charset;
-        }
-
         /* If the from and to character sets are identical, return now. */
         if (!$force && $from == $to) {
             return $input;
index 615d6ff..061bc8c 100644 (file)
@@ -19,7 +19,7 @@ if (!$vars->exists('id') && $vars->exists('timer')) {
     $timer_id = $vars->get('timer');
     $timers = @unserialize($prefs->getValue('running_timers', false));
     if ($timers && isset($timers[$timer_id])) {
-        $tname = Horde_String::convertCharset($timers[$timer_id]['name'], $prefs->getCharset());
+        $tname = Horde_String::convertCharset($timers[$timer_id]['name'], $prefs->getCharset(), 'UTF-8');
         $tformat = $prefs->getValue('twentyFour') ? 'G:i' : 'g:i a';
         $vars->set('hours', round((float)(time() - $timer_id) / 3600, 2));
         if ($prefs->getValue('add_description')) {
index 48cd5e6..b01cf4e 100644 (file)
@@ -144,7 +144,7 @@ class Hermes_Application extends Horde_Registry_Application
                     $tree->addNode(
                         $parent . '__timer_' . $i,
                         $parent,
-                        Horde_String::convertCharset($timer['name'], $prefs->getCharset()) . sprintf(" (%s)", $hours),
+                        Horde_String::convertCharset($timer['name'], $prefs->getCharset(), 'UTF-8') . sprintf(" (%s)", $hours),
                         1,
                         false,
                         array(
index 65cbf9b..7765cc3 100644 (file)
@@ -62,14 +62,14 @@ if (isset($result)) {
             if ($first) {
                 echo '<tr>';
                 foreach ($row as $key => $val) {
-                    echo '<th align="left">' . (!strlen($key) ? '&nbsp;' : htmlspecialchars(Horde_String::convertCharset($key, $conf['sql']['charset']))) . '</th>';
+                    echo '<th align="left">' . (!strlen($key) ? '&nbsp;' : htmlspecialchars(Horde_String::convertCharset($key, $conf['sql']['charset'], 'UTF-8'))) . '</th>';
                 }
                 echo '</tr>';
                 $first = false;
             }
             echo '<tr>';
             foreach ($row as $val) {
-                echo '<td class="fixed">' . (!strlen($val) ? '&nbsp;' : htmlspecialchars(Horde_String::convertCharset($val, $conf['sql']['charset']))) . '</td>';
+                echo '<td class="fixed">' . (!strlen($val) ? '&nbsp;' : htmlspecialchars(Horde_String::convertCharset($val, $conf['sql']['charset'], 'UTF-8'))) . '</td>';
             }
             echo '</tr>';
         }
@@ -83,7 +83,7 @@ if (isset($result)) {
                 echo '<tr><th align="left">' . (isset($description) ? htmlspecialchars($description) : '&nbsp;') . '</th></tr>';
                 $first = false;
             }
-            echo '<tr><td class="fixed">' . (!strlen($val) ? '&nbsp;' : htmlspecialchars(Horde_String::convertCharset($val, $conf['sql']['charset']))) . '</td></tr>';
+            echo '<tr><td class="fixed">' . (!strlen($val) ? '&nbsp;' : htmlspecialchars(Horde_String::convertCharset($val, $conf['sql']['charset'], 'UTF-8'))) . '</td></tr>';
         }
         echo '</table>';
     } else {
index 21aa174..dd626b2 100644 (file)
@@ -197,7 +197,6 @@ class IMP_Hooks
 //    public function pre_sent($message, $headers)
 //    {
 //        // Example: Add custom headers to outgoing message.
-//        $charset = 'UTF-8';
 //        $custom_hdrs = array();
 //        $hdr_charset = $message->getHeaderCharset();
 //
@@ -213,7 +212,7 @@ class IMP_Hooks
 //        $custom_hdrs['X-Remote-Browser'] = $_SERVER['HTTP_USER_AGENT'];
 //
 //        foreach ($custom_hdrs as $key => $val) {
-//            $headers->addHeader($key, Horde_String::convertCharset($val, $charset, $hdr_charset));
+//            $headers->addHeader($key, Horde_String::convertCharset($val, 'UTF-8', $hdr_charset));
 //        }
 //    }
 
index 4b95072..568cce6 100644 (file)
@@ -94,7 +94,7 @@ $_prefs['sent_mail_folder'] = array(
     // If the mailbox value contains non-ASCII characters, it must be encoded
     // in the UTF7-IMAP charset (RFC 3501 [5.1.3]). This entry will do the
     // necessary conversion.
-    // 'value' => Horde_String::convertCharset('Sent', null, 'UTF7-IMAP'),
+    // 'value' => Horde_String::convertCharset('Sent', 'UFT-8', 'UTF7-IMAP'),
     // Exchange servers use this default value instead.
     // 'value' => 'Sent Items'
 );
@@ -138,7 +138,7 @@ $_prefs['drafts_folder'] = array(
     // If the mailbox value contains non-ASCII characters, it must be encoded
     // in the UTF7-IMAP charset (RFC 3501 [5.1.3]). This entry will do the
     // necessary conversion.
-    // 'value' => Horde_String::convertCharset('Drafts', null, 'UTF7-IMAP')
+    // 'value' => Horde_String::convertCharset('Drafts', 'UTF-8', 'UTF7-IMAP')
 );
 
 // trash folder selection widget.
@@ -155,7 +155,7 @@ $_prefs['trash_folder'] = array(
     // If the mailbox value contains non-ASCII characters, it must be encoded
     // in the UTF7-IMAP charset (RFC 3501 [5.1.3]). This entry will do the
     // necessary conversion.
-    // 'value' => Horde_String::convertCharset('Trash', null, 'UTF7-IMAP'),
+    // 'value' => Horde_String::convertCharset('Trash', 'UTF-8', 'UTF7-IMAP'),
     // Exchange servers use this default value instead.
     // 'value' => 'Deleted Items'
 );
@@ -174,7 +174,7 @@ $_prefs['spam_folder'] = array(
     // If the mailbox value contains non-ASCII characters, it must be encoded
     // in the UTF7-IMAP charset (RFC 3501 [5.1.3]). This entry will do the
     // necessary conversion.
-    // 'value' => Horde_String::convertCharset('Spam', null, 'UTF7-IMAP')
+    // 'value' => Horde_String::convertCharset('Spam', 'UTF-8', 'UTF7-IMAP')
 );
 
 
index fe9deda..fe02376 100644 (file)
@@ -30,7 +30,6 @@ if (!$conf['user']['allow_folders']) {
 $subscribe = $prefs->getValue('subscribe');
 $showAll = (!$subscribe || $_SESSION['imp']['showunsub']);
 
-$charset = 'UTF-8';
 $vars = Horde_Variables::getDefaultVariables();
 
 /* Get the base URL for this page. */
@@ -131,7 +130,7 @@ case 'import_mbox':
     if ($vars->import_folder) {
         try {
             $browser->wasFileUploaded('mbox_upload', _("mailbox file"));
-            $res = $imp_folder->importMbox(Horde_String::convertCharset($vars->import_folder, $charset, 'UTF7-IMAP'), $_FILES['mbox_upload']['tmp_name']);
+            $res = $imp_folder->importMbox(Horde_String::convertCharset($vars->import_folder, 'UTF-8', 'UTF7-IMAP'), $_FILES['mbox_upload']['tmp_name']);
             $mbox_name = basename(Horde_Util::dispelMagicQuotes($_FILES['mbox_upload']['name']));
             if ($res === false) {
                 $notification->push(sprintf(_("There was an error importing %s."), $mbox_name), 'horde.error');
@@ -150,7 +149,7 @@ case 'import_mbox':
 case 'create_folder':
     if ($vars->new_mailbox) {
         try {
-            $new_mailbox = $imaptree->createMailboxName(array_shift($folder_list), Horde_String::convertCharset($vars->new_mailbox, $charset, 'UTF7-IMAP'));
+            $new_mailbox = $imaptree->createMailboxName(array_shift($folder_list), Horde_String::convertCharset($vars->new_mailbox, 'UTF-8', 'UTF7-IMAP'));
             $imp_folder->create($new_mailbox, $subscribe);
         } catch (Horde_Exception $e) {
             $notification->push($e);
@@ -182,7 +181,7 @@ case 'rename_folder':
                 $new = $old_ns['name'] . $new;
             }
 
-            $imp_folder->rename($old_name, Horde_String::convertCharset($new, $charset, 'UTF7-IMAP'));
+            $imp_folder->rename($old_name, Horde_String::convertCharset($new, 'UTF-8', 'UTF7-IMAP'));
         }
     }
     break;
@@ -343,7 +342,7 @@ if ($_SESSION['imp']['file_upload'] && ($vars->actionID == 'import_mbox')) {
     $i_template->setOption('gettext', true);
     $i_template->set('folders_url', $folders_url_ob);
     $i_template->set('import_folder', $folder_list[0]);
-    $i_template->set('folder_name', htmlspecialchars(Horde_String::convertCharset($folder_list[0], 'UTF7-IMAP'), ENT_COMPAT, $charset));
+    $i_template->set('folder_name', htmlspecialchars(Horde_String::convertCharset($folder_list[0], 'UTF7-IMAP', 'UTF-8')));
     $i_template->set('folders_token', $folders_token);
     echo $i_template->fetch(IMP_TEMPLATES . '/imp/folders/import.html');
     require $registry->get('templates', 'horde') . '/common-footer.inc';
index b157651..c2001c3 100644 (file)
@@ -556,23 +556,21 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             $mdn->addMdnRequestHeaders($barefrom);
         }
 
-        $browser_charset = 'UTF-8';
-
-        $headers->addHeader('From', Horde_String::convertCharset($header['from'], $browser_charset, $charset));
+        $headers->addHeader('From', Horde_String::convertCharset($header['from'], 'UTF-8', $charset));
 
         if (!empty($header['replyto']) &&
             ($header['replyto'] != $barefrom)) {
-            $headers->addHeader('Reply-to', Horde_String::convertCharset($header['replyto'], $browser_charset, $charset));
+            $headers->addHeader('Reply-to', Horde_String::convertCharset($header['replyto'], 'UTF-8', $charset));
         }
         if (!empty($header['to'])) {
-            $headers->addHeader('To', Horde_String::convertCharset($header['to'], $browser_charset, $charset));
+            $headers->addHeader('To', Horde_String::convertCharset($header['to'], 'UTF-8', $charset));
         } elseif (empty($header['to']) && empty($header['cc'])) {
             $headers->addHeader('To', 'undisclosed-recipients:;');
         }
         if (!empty($header['cc'])) {
-            $headers->addHeader('Cc', Horde_String::convertCharset($header['cc'], $browser_charset, $charset));
+            $headers->addHeader('Cc', Horde_String::convertCharset($header['cc'], 'UTF-8', $charset));
         }
-        $headers->addHeader('Subject', Horde_String::convertCharset($header['subject'], $browser_charset, $charset));
+        $headers->addHeader('Subject', Horde_String::convertCharset($header['subject'], 'UTF-8', $charset));
 
         /* Add necessary headers for replies. */
         $this->_addReferences($headers);
@@ -648,7 +646,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
             /* Keep Bcc: headers on saved messages. */
             if (!empty($header['bcc'])) {
-                $headers->addHeader('Bcc', Horde_String::convertCharset($header['bcc'], $browser_charset, $charset));
+                $headers->addHeader('Bcc', Horde_String::convertCharset($header['bcc'], 'UTF-8', $charset));
             }
 
             /* Strip attachments if requested. */
@@ -687,7 +685,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             }
 
             try {
-                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], 'UTF-8', 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags)));
+                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append($opts['sent_folder'], array(array('data' => $fcc, 'flags' => $flags)));
             } catch (Horde_Imap_Client_Exception $e) {
                 $notification->push(sprintf(_("Message sent successfully, but not saved to %s"), IMP::displayFolder($opts['sent_folder'])));
                 $sent_saved = false;
@@ -996,7 +994,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         // Convert IDN hosts to ASCII.
         if (function_exists('idn_to_ascii')) {
             $old_error = error_reporting(0);
-            $host = idn_to_ascii(Horde_String::convertCharset($host, 'UTF-8', 'UTF-8'));
+            $host = idn_to_ascii($host);
             error_reporting($old_error);
         } elseif (Horde_Mime::is8bit($ob['mailbox'], 'UTF-8')) {
             throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email));
@@ -1033,8 +1031,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
     protected function _createMimeMessage($to, $body, $charset,
                                           $options = array())
     {
-        $nls_charset = 'UTF-8';
-        $body = Horde_String::convertCharset($body, $nls_charset, $charset);
+        $body = Horde_String::convertCharset($body, 'UTF-8', $charset);
 
         if (!empty($options['html'])) {
             $body_html = $body;
@@ -1073,7 +1070,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             $htmlBody->setType('text/html');
             $htmlBody->setCharset($charset);
             $htmlBody->setDisposition('inline');
-            $htmlBody->setDescription(Horde_String::convertCharset(_("HTML Message"), $nls_charset, $charset));
+            $htmlBody->setDescription(Horde_String::convertCharset(_("HTML Message"), 'UTF-8', $charset));
 
             /* Add default font CSS information here. The data comes to us
              * with no HTML body tag - so simply wrap the data in a body
@@ -1094,7 +1091,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
             $htmlBody->setContents($GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body_html, 'cleanhtml', array('charset' => $charset)));
 
-            $textBody->setDescription(Horde_String::convertCharset(_("Plaintext Message"), $nls_charset, $charset));
+            $textBody->setDescription(Horde_String::convertCharset(_("Plaintext Message"), 'UTF-8', $charset));
 
             $textpart = new Horde_Mime_Part();
             $textpart->setType('multipart/alternative');
@@ -2175,13 +2172,13 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             '/%r/' => $h->getValue('date'),
 
             /* Date as ddd, dd mmm yyyy. */
-            '/%d/' => Horde_String::convertCharset(strftime("%a, %d %b %Y", $udate), 'UTF-8'),
+            '/%d/' => strftime("%a, %d %b %Y", $udate),
 
             /* Date in locale's default. */
-            '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), 'UTF-8'),
+            '/%x/' => strftime("%x", $udate),
 
             /* Date and time in locale's default. */
-            '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), 'UTF-8'),
+            '/%c/' => strftime("%c", $udate),
 
             /* Message-ID. */
             '/%m/' => $message_id,
@@ -2464,9 +2461,8 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $part = $contents->getMIMEPart($body_id);
         $type = $part->getType();
         $part_charset = $part->getCharset();
-        $charset = 'UTF-8';
 
-        $msg = Horde_String::convertCharset($part->getContents(), $part_charset, $charset);
+        $msg = Horde_String::convertCharset($part->getContents(), $part_charset, 'UTF-8');
 
         /* Enforce reply limits. */
         if (!empty($options['replylimit']) &&
@@ -2478,9 +2474,9 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         }
 
         if ($mode == 'html') {
-            $msg = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, array('Cleanhtml', 'Xss'), array(array('body_only' => true), array('charset' => $charset, 'strip_styles' => true, 'strip_style_attributes' => false)));
+            $msg = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, array('Cleanhtml', 'Xss'), array(array('body_only' => true), array('strip_styles' => true, 'strip_style_attributes' => false)));
         } elseif ($type == 'text/html') {
-            $msg = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, 'Html2text', array('charset' => $charset));
+            $msg = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($msg, 'Html2text');
             $type = 'text/plain';
         }
 
@@ -2513,8 +2509,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
         /* Determine default encoding. */
         $encoding = $GLOBALS['registry']->getEmailCharset();
-        if (($charset == 'UTF-8') &&
-            (strcasecmp($part_charset, 'US-ASCII') !== 0) &&
+        if ((strcasecmp($part_charset, 'US-ASCII') !== 0) &&
             (strcasecmp($part_charset, $encoding) !== 0)) {
             $encoding = 'UTF-8';
         }
index f6dbffd..3c7a7cd 100644 (file)
@@ -533,12 +533,11 @@ class IMP_Contents
         // Retrieve 3x the size of $maxlen of bodytext data. This should
         // account for any content-encoding & HTML tags.
         $pmime = $this->getMIMEPart($mimeid, array('length' => $maxlen * 3));
-        $charset = 'UTF-8';
 
-        $ptext = Horde_String::convertCharset($pmime->getContents(), $pmime->getCharset(), $charset);
+        $ptext = Horde_String::convertCharset($pmime->getContents(), $pmime->getCharset(), 'UTF-8');
 
         if ($pmime->getType() == 'text/html') {
-            $ptext = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($ptext, 'Html2text', array('charset' => $charset));
+            $ptext = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($ptext, 'Html2text');
         }
 
         $this->_build = $oldbuild;
index 3628040..97f54ff 100644 (file)
@@ -393,7 +393,7 @@ class IMP
             }
         }
 
-        $cache[$folder] = Horde_String::convertCharset($out, 'UTF7-IMAP');
+        $cache[$folder] = Horde_String::convertCharset($out, 'UTF7-IMAP', 'UTF-8');
 
         return $cache[$folder];
     }
index 5104177..c6eacb4 100644 (file)
@@ -117,7 +117,7 @@ class IMP_Imap_Flags
         foreach ($avail_flags as $key) {
             if (!isset($this->_flags[$key])) {
                 /* Keywords might be UTF7-IMAP encoded. */
-                $ret[$key] = $this->_createEntry(Horde_String::convertCharset($key, 'UTF7-IMAP'));
+              $ret[$key] = $this->_createEntry(Horde_String::convertCharset($key, 'UTF7-IMAP', 'UTF-8'));
                 $ret[$key]['flag'] = $key;
                 $this->_tempflags[$key] = $ret[$key];
             } else {
index 1234427..e8a6440 100644 (file)
@@ -78,7 +78,7 @@ class IMP_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain
 
         // Convert to the local charset.
         if ($inline) {
-            $text = Horde_String::convertCharset($text, $charset, $this->getConfigParam('charset'));
+            $text = Horde_String::convertCharset($text, $charset, 'UTF-8');
             $charset = $this->getConfigParam('charset');
         }
         $type = 'text/html; charset=' . $charset;
@@ -274,7 +274,7 @@ class IMP_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain
 
                     $part2 = new Horde_Mime_Part();
                     $part2->setType('application/pgp-signature');
-                    $part2->setContents(Horde_String::convertCharset(implode("\n", $val['data']) . "\n" . implode("\n", $sig['data']), $charset));
+                    $part2->setContents(Horde_String::convertCharset(implode("\n", $val['data']) . "\n" . implode("\n", $sig['data']), $charset, 'UTF-8'));
                     // A true pgp-signature part would only contain the
                     // detached signature. However, we need to carry around
                     // the entire armored text to verify correctly. Use a
@@ -304,7 +304,7 @@ class IMP_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain
      */
     protected function _parseUUencode()
     {
-        $text = Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset());
+        $text = Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset(), 'UTF-8');
 
         $files = Horde_Mime::uudecode($text);
         if (empty($files)) {
@@ -353,7 +353,7 @@ class IMP_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain
         );
 
         return '<div class="fixed">' .
-            $this->_textFilter(Horde_String::convertCharset(fread($stream, 1024), $this->_mimepart->getCharset(), $this->getConfigParam('charset')), array_keys($filters), array_values($filters)) .
+            $this->_textFilter(Horde_String::convertCharset(fread($stream, 1024), $this->_mimepart->getCharset(), 'UTF-8'), array_keys($filters), array_values($filters)) .
             ' [...]</div>';
     }
 
index e62d83b..db0b152 100644 (file)
@@ -41,7 +41,7 @@
 
 function _sanitizeName($name)
 {
-    return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, 'UTF-8', 'UTF-8')), ' _'), 'UTF-8');
+    return trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', $name), ' _');
 }
 
 require_once dirname(__FILE__) . '/lib/Application.php';
index ad54d6e..fcbf555 100644 (file)
@@ -69,11 +69,11 @@ class Ingo_Storage_Filters_Sql extends Ingo_Storage_Filters {
         while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
             $data[$row['rule_order']] = array(
                 'id' => (int)$row['rule_id'],
-                'name' => Horde_String::convertCharset($row['rule_name'], $this->_params['charset']),
+                'name' => Horde_String::convertCharset($row['rule_name'], $this->_params['charset'], 'UTF-8'),
                 'action' => (int)$row['rule_action'],
-                'action-value' => Horde_String::convertCharset($row['rule_value'], $this->_params['charset']),
+                'action-value' => Horde_String::convertCharset($row['rule_value'], $this->_params['charset'], 'UTF-8'),
                 'flags' => (int)$row['rule_flags'],
-                'conditions' => empty($row['rule_conditions']) ? null : Horde_String::convertCharset(unserialize($row['rule_conditions']), $this->_params['charset']),
+                'conditions' => empty($row['rule_conditions']) ? null : Horde_String::convertCharset(unserialize($row['rule_conditions']), $this->_params['charset'], 'UTF-8'),
                 'combine' => (int)$row['rule_combine'],
                 'stop' => (bool)$row['rule_stop'],
                 'disable' => !(bool)$row['rule_active']);
index f3c464f..b3cbc40 100644 (file)
@@ -142,8 +142,8 @@ class Ingo_Storage_Sql extends Ingo_Storage
                 $ob->setVacationEnd((int)$data['vacation_end']);
                 $ob->setVacationExcludes(explode("\n", $data['vacation_excludes']), false);
                 $ob->setVacationIgnorelist((bool)$data['vacation_ignorelists']);
-                $ob->setVacationReason(Horde_String::convertCharset($data['vacation_reason'], $this->_params['charset']));
-                $ob->setVacationSubject(Horde_String::convertCharset($data['vacation_subject'], $this->_params['charset']));
+                $ob->setVacationReason(Horde_String::convertCharset($data['vacation_reason'], $this->_params['charset'], 'UTF-8'));
+                $ob->setVacationSubject(Horde_String::convertCharset($data['vacation_subject'], $this->_params['charset'], 'UTF-8'));
                 $ob->setSaved(true);
             } elseif ($data = @unserialize($GLOBALS['prefs']->getDefault('vacation'))) {
                 $ob->setVacationAddresses($data['addresses'], false);
index bb97d90..359bd8b 100644 (file)
@@ -119,7 +119,7 @@ class Jonah_Driver_Sql extends Jonah_Driver
             throw new Jonah_Exception($result);
         }
         for ($i = 0; $i < count($result); $i++) {
-            $result[$i]['channel_name'] = Horde_String::convertCharset($result[$i]['channel_name'], $this->_params['charset']);
+            $result[$i]['channel_name'] = Horde_String::convertCharset($result[$i]['channel_name'], $this->_params['charset'], 'UTF-8');
         }
 
         return $result;
index 8df6d2d..c56e588 100644 (file)
@@ -929,7 +929,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
      */
     public function convertFromDriver($value)
     {
-        return Horde_String::convertCharset($value, $this->_params['charset']);
+        return Horde_String::convertCharset($value, $this->_params['charset'], 'UTF-8');
     }
 
     /**
index abc009e..360cdbb 100644 (file)
@@ -373,7 +373,7 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
 
         /* Decrypt note if requested. */
         $encrypted = false;
-        $body = Horde_String::convertCharset($row['memo_body'], $this->_params['charset']);
+        $body = Horde_String::convertCharset($row['memo_body'], $this->_params['charset'], 'UTF-8');
         if (strpos($body, '-----BEGIN PGP MESSAGE-----') === 0) {
             $encrypted = true;
             if (empty($passphrase)) {
@@ -395,10 +395,10 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
         /* Create a new task based on $row's values. */
         return array('memolist_id' => $row['memo_owner'],
                      'memo_id' => $row['memo_id'],
-                     'uid' => Horde_String::convertCharset($row['memo_uid'], $this->_params['charset']),
-                     'desc' => Horde_String::convertCharset($row['memo_desc'], $this->_params['charset']),
+                     'uid' => Horde_String::convertCharset($row['memo_uid'], $this->_params['charset'], 'UTF-8'),
+                     'desc' => Horde_String::convertCharset($row['memo_desc'], $this->_params['charset'], 'UTF-8'),
                      'body' => $body,
-                     'category' => Horde_String::convertCharset($row['memo_category'], $this->_params['charset']),
+                     'category' => Horde_String::convertCharset($row['memo_category'], $this->_params['charset'], 'UTF-8'),
                      'encrypted' => $encrypted);
     }
 
index 18ded45..155968a 100644 (file)
@@ -451,13 +451,13 @@ class Nag_Driver_Sql extends Nag_Driver {
         return array(
             'tasklist_id' => $row['task_owner'],
             'task_id' => $row['task_id'],
-            'uid' => Horde_String::convertCharset($row['task_uid'], $this->_params['charset']),
+            'uid' => Horde_String::convertCharset($row['task_uid'], $this->_params['charset'], 'UTF-8'),
             'parent' => $row['task_parent'],
             'owner' => $row['task_creator'],
             'assignee' => $row['task_assignee'],
-            'name' => Horde_String::convertCharset($row['task_name'], $this->_params['charset']),
-            'desc' => Horde_String::convertCharset($row['task_desc'], $this->_params['charset']),
-            'category' => Horde_String::convertCharset($row['task_category'], $this->_params['charset']),
+            'name' => Horde_String::convertCharset($row['task_name'], $this->_params['charset'], 'UTF-8'),
+            'desc' => Horde_String::convertCharset($row['task_desc'], $this->_params['charset'], 'UTF-8'),
+            'category' => Horde_String::convertCharset($row['task_category'], $this->_params['charset'], 'UTF-8'),
             'start' => $row['task_start'],
             'due' => $row['task_due'],
             'priority' => $row['task_priority'],
@@ -465,7 +465,7 @@ class Nag_Driver_Sql extends Nag_Driver {
             'completed' => $row['task_completed'],
             'completed_date' => isset($row['task_completed_date']) ? $row['task_completed_date'] : null,
             'alarm' => $row['task_alarm'],
-            'methods' => Horde_String::convertCharset(@unserialize($row['task_alarm_methods']), $this->_params['charset']),
+            'methods' => Horde_String::convertCharset(@unserialize($row['task_alarm_methods']), $this->_params['charset'], 'UTF-8'),
             'private' => $row['task_private']
         );
     }
index e705fac..a3e9d50 100644 (file)
@@ -112,7 +112,8 @@ class Trean_Bookmarks
                                              'bookmark_' . $criterion[0],
                                              $criterion[1],
                                              Horde_String::convertCharset($criterion[2],
-                                                                    $GLOBALS['conf']['sql']['charset']),
+                                                                          $GLOBALS['conf']['sql']['charset'],
+                                                                          'UTF-8'),
                                              true,
                                              isset($criterion[3]) ? $criterion[3] : array());
             $clauses[] = $clause[0];
@@ -545,7 +546,7 @@ class Trean_Bookmarks
             foreach ($bookmark as $key => $value)
             if (!empty($value) && !is_numeric($value)) {
                 $cvBookmarks[$key] = Horde_String::convertCharset(
-                    $value, $GLOBALS['conf']['sql']['charset']);
+                    $value, $GLOBALS['conf']['sql']['charset'], 'UTF-8');
             } else {
                 $cvBookmarks[$key] = $value;
             }
index ec42005..1601df7 100644 (file)
@@ -299,7 +299,7 @@ class Turba_Driver_Ldap extends Turba_Driver
         $this->_encodeAttributes($attributes);
 
         if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, 'UTF-8', $this->_params['charset']), $attributes)) {
-            throw new Turba_Exception('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:UTF-8');
+            throw new Turba_Exception('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . '])');
         }
     }
 
@@ -507,7 +507,7 @@ class Turba_Driver_Ldap extends Turba_Driver
             foreach ($fields as $field) {
                 $field_l = Horde_String::lower($field);
                 if ($field == 'dn') {
-                    $result[$field] = Horde_String::convertCharset($entry[$field_l], $this->_params['charset']);
+                    $result[$field] = Horde_String::convertCharset($entry[$field_l], $this->_params['charset'], 'UTF-8');
                 } else {
                     $result[$field] = '';
                     if (!empty($entry[$field_l])) {
@@ -515,7 +515,7 @@ class Turba_Driver_Ldap extends Turba_Driver
                             if (!empty($result[$field])) {
                                 $result[$field] .= $this->_params['multiple_entry_separator'];
                             }
-                            $result[$field] .= Horde_String::convertCharset($entry[$field_l][$j], $this->_params['charset']);
+                            $result[$field] .= Horde_String::convertCharset($entry[$field_l][$j], $this->_params['charset'], 'UTF-8');
                         }
 
                         /* If schema checking is enabled check the
index 3f63b18..72bdd15 100644 (file)
@@ -647,7 +647,7 @@ class Turba_Driver_Sql extends Turba_Driver
      */
     protected function _convertFromDriver($value)
     {
-        return Horde_String::convertCharset($value, $this->_params['charset']);
+        return Horde_String::convertCharset($value, $this->_params['charset'], 'UTF-8');
     }
 
     /**
index e31d107..8896844 100644 (file)
@@ -297,7 +297,7 @@ class Whups_Driver_sql extends Whups_Driver {
             . ' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
         $values = array($ticketId,
                         Horde_String::convertCharset($summary, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $requester,
                         $type,
                         $state,
@@ -1007,7 +1007,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return array();
         }
 
-        $info = Horde_String::convertCharset($info, $this->_params['charset']);
+        $info = Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
 
         $tickets = array();
         foreach ($info as $ticket) {
@@ -1115,7 +1115,7 @@ class Whups_Driver_sql extends Whups_Driver {
                 return $result;
             }
             $guestCache[$guest_id] = Horde_String::convertCharset(
-                $result, $this->_params['charset']);
+                $result, $this->_params['charset'], 'UTF-8');
         }
         return $guestCache[$guest_id];
     }
@@ -1162,7 +1162,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $history;
         }
 
-        $history = Horde_String::convertCharset($history, $this->_params['charset']);
+        $history = Horde_String::convertCharset($history, $this->_params['charset'], 'UTF-8');
         for ($i = 0, $iMax = count($history); $i < $iMax; ++$i) {
             if ($history[$i]['log_type'] == 'queue') {
                 $queue = $this->getQueue($history[$i]['log_value_num']);
@@ -1279,7 +1279,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $queues;
         }
 
-        return Horde_String::convertCharset($queues, $this->_params['charset']);
+        return Horde_String::convertCharset($queues, $this->_params['charset'], 'UTF-8');
     }
 
     function getQueueInternal($queueId)
@@ -1305,7 +1305,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return false;
         }
 
-        $queue = Horde_String::convertCharset($queue, $this->_params['charset']);
+        $queue = Horde_String::convertCharset($queue, $this->_params['charset'], 'UTF-8');
         $queues[$queueId] = array('id' => (int)$queue['queue_id'],
                                   'name' => $queue['queue_name'],
                                   'description' => $queue['queue_description'],
@@ -1334,7 +1334,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $queue;
         }
 
-        $queue = Horde_String::convertCharset($queue, $this->_params['charset']);
+        $queue = Horde_String::convertCharset($queue, $this->_params['charset'], 'UTF-8');
         $queue = $queue[0];
         return array('id' => $queue[0],
                      'name' => $queue[1],
@@ -1362,7 +1362,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return array();
         }
 
-        $internals = Horde_String::convertCharset($queues, $this->_params['charset']);
+        $internals = Horde_String::convertCharset($queues, $this->_params['charset'], 'UTF-8');
         return $internals;
     }
 
@@ -1587,7 +1587,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $type;
         }
 
-        $type = Horde_String::convertCharset($type, $this->_params['charset']);
+        $type = Horde_String::convertCharset($type, $this->_params['charset'], 'UTF-8');
         return array('id' => $typeId,
                      'name' => isset($type[$typeId][0]) ? $type[$typeId][0] : '',
                      'description' => isset($type[$typeId][1]) ? $type[$typeId][1] : '');
@@ -1609,7 +1609,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return array();
         }
 
-        return Horde_String::convertCharset($types, $this->_params['charset']);
+        return Horde_String::convertCharset($types, $this->_params['charset'], 'UTF-8');
     }
 
     function getTypeIds($queueId)
@@ -1634,7 +1634,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return array();
         }
 
-        return Horde_String::convertCharset($types, $this->_params['charset']);
+        return Horde_String::convertCharset($types, $this->_params['charset'], 'UTF-8');
     }
 
     function getAllTypeInfo()
@@ -1650,7 +1650,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $info;
         }
 
-        return Horde_String::convertCharset($info, $this->_params['charset']);
+        return Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
     }
 
     function getTypeName($type)
@@ -1667,7 +1667,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $name;
         }
 
-        return Horde_String::convertCharset($name, $this->_params['charset']);
+        return Horde_String::convertCharset($name, $this->_params['charset'], 'UTF-8');
     }
 
     function updateType($typeId, $name, $description)
@@ -1675,9 +1675,9 @@ class Whups_Driver_sql extends Whups_Driver {
         $query = 'UPDATE whups_types' .
                  ' SET type_name = ?, type_description = ? WHERE type_id = ?';
         $values = array(Horde_String::convertCharset($name, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($description, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $typeId);
         Horde::logMessage(
             sprintf('Whups_Driver_sql::updateType(): query="%s"; values="%s"',
@@ -1770,7 +1770,7 @@ class Whups_Driver_sql extends Whups_Driver {
             }
         }
 
-        return Horde_String::convertCharset($states, $this->_params['charset']);
+        return Horde_String::convertCharset($states, $this->_params['charset'], 'UTF-8');
     }
 
     function getState($stateId)
@@ -1790,7 +1790,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $state;
         }
 
-        $state = Horde_String::convertCharset($state, $this->_params['charset']);
+        $state = Horde_String::convertCharset($state, $this->_params['charset'], 'UTF-8');
         return array(
             'id' => $stateId,
             'name' => isset($state[$stateId][0]) ? $state[$stateId][0] : '',
@@ -1815,7 +1815,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $info;
         }
 
-        return Horde_String::convertCharset($info, $this->_params['charset']);
+        return Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
     }
 
     function updateState($stateId, $name, $description, $category)
@@ -1823,11 +1823,11 @@ class Whups_Driver_sql extends Whups_Driver {
         $query = 'UPDATE whups_states SET state_name = ?, '
             . 'state_description = ?, state_category = ? WHERE state_id = ?';
         $values = array(Horde_String::convertCharset($name, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($description, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($category, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $stateId);
         Horde::logMessage(
             sprintf('Whups_Driver_sql::updateState(): query="%s"; values="%s"',
@@ -1900,7 +1900,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $query;
         }
 
-        return Horde_String::convertCharset($query, $this->_params['charset']);
+        return Horde_String::convertCharset($query, $this->_params['charset'], 'UTF-8');
     }
 
     /**
@@ -1930,7 +1930,7 @@ class Whups_Driver_sql extends Whups_Driver {
                             serialize($query->query));
         }
         $values = Horde_String::convertCharset($values, 'UTF-8',
-                                         $this->_params['charset']);
+                                               $this->_params['charset']);
         Horde::logMessage(
             sprintf('Whups_Driver_sql::saveQuery(): query="%s"; values="%s"',
                     $q, implode(',', $values)), 'DEBUG');
@@ -1978,7 +1978,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $info;
         }
 
-        return Horde_String::convertCharset($info, $this->_params['charset']);
+        return Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
     }
 
     function getPriorities($type = null)
@@ -2012,7 +2012,7 @@ class Whups_Driver_sql extends Whups_Driver {
             }
         }
 
-        return Horde_String::convertCharset($priorities, $this->_params['charset']);
+        return Horde_String::convertCharset($priorities, $this->_params['charset'], 'UTF-8');
     }
 
     function getPriority($priorityId)
@@ -2032,7 +2032,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $priority;
         }
 
-        $priority = Horde_String::convertCharset($priority, $this->_params['charset']);
+        $priority = Horde_String::convertCharset($priority, $this->_params['charset'], 'UTF-8');
         return array('id' => $priorityId,
                      'name' => isset($priority[$priorityId][0])
                          ? $priority[$priorityId][0] : '',
@@ -2048,9 +2048,9 @@ class Whups_Driver_sql extends Whups_Driver {
                  ' SET priority_name = ?, priority_description = ?' .
                  ' WHERE priority_id = ?';
         $values = array(Horde_String::convertCharset($name, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($description, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $priorityId);
         Horde::logMessage(
             sprintf('Whups_Driver_sql::updatePriority(): query="%s"; values="%s"',
@@ -2117,7 +2117,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $info;
         }
 
-        return Horde_String::convertCharset($info, $this->_params['charset']);
+        return Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
     }
 
     function getVersionInternal($versionId)
@@ -2137,7 +2137,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $version;
         }
 
-        $version = Horde_String::convertCharset($version, $this->_params['charset']);
+        $version = Horde_String::convertCharset($version, $this->_params['charset'], 'UTF-8');
         return array('id' => $versionId,
                      'name' => isset($version[$versionId][0])
                          ? $version[$versionId][0] : '',
@@ -2152,9 +2152,9 @@ class Whups_Driver_sql extends Whups_Driver {
             . 'version_description = ?, version_active = ? '
             . 'WHERE version_id = ?';
         $values = array(Horde_String::convertCharset($name, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($description, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         (int)$active,
                         (int)$versionId);
         Horde::logMessage(
@@ -2195,7 +2195,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $info;
         }
 
-        return Horde_String::convertCharset($info, $this->_params['charset']);
+        return Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
     }
 
     /**
@@ -2219,7 +2219,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $reply;
         }
 
-        return Horde_String::convertCharset($reply, $this->_params['charset']);
+        return Horde_String::convertCharset($reply, $this->_params['charset'], 'UTF-8');
     }
 
     /**
@@ -2234,9 +2234,9 @@ class Whups_Driver_sql extends Whups_Driver {
         $query = 'UPDATE whups_replies SET reply_name = ?, '
             . 'reply_text = ? WHERE reply_id = ?';
         $values = array(Horde_String::convertCharset($name, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($text, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $reply);
         Horde::logMessage(
             sprintf('Whups_Driver_sql::updateReply(): query="%s"; values="%s"',
@@ -2377,13 +2377,13 @@ class Whups_Driver_sql extends Whups_Driver {
         $values = array($new_id,
                         $type_id,
                         Horde_String::convertCharset($name, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($desc, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $type,
                         serialize(
                             Horde_String::convertCharset($params, 'UTF-8',
-                                                   $this->_params['charset'])),
+                                                         $this->_params['charset'])),
                         (int)($required == 'on'));
 
         Horde::logMessage(
@@ -2406,14 +2406,14 @@ class Whups_Driver_sql extends Whups_Driver {
             . 'attribute_type = ?, attribute_params = ?, '
             . 'attribute_required = ? WHERE attribute_id = ?';
         $values = array(Horde_String::convertCharset($newname, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         Horde_String::convertCharset($newdesc, 'UTF-8',
-                                               $this->_params['charset']),
+                                                     $this->_params['charset']),
                         $newtype,
                         serialize(
                             Horde_String::convertCharset($newparams,
-                                                   'UTF-8',
-                                                   $this->_params['charset'])),
+                                                         'UTF-8',
+                                                         $this->_params['charset'])),
                         (int)($newrequired == 'on'),
                         $attribute_id);
         Horde::logMessage(
@@ -2459,7 +2459,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $attributes;
         }
 
-        return Horde_String::convertCharset($attributes, $this->_params['charset']);
+        return Horde_String::convertCharset($attributes, $this->_params['charset'], 'UTF-8');
     }
 
     function getAttributeDesc($attribute_id)
@@ -2484,14 +2484,14 @@ class Whups_Driver_sql extends Whups_Driver {
         return array(
             'id' => $attribute_id,
             'attribute_name' => Horde_String::convertCharset(
-                $attribute['attribute_name'], $this->_params['charset']),
+                $attribute['attribute_name'], $this->_params['charset'], 'UTF-8'),
             'attribute_description' => Horde_String::convertCharset(
-                $attribute['attribute_description'], $this->_params['charset']),
+                $attribute['attribute_description'], $this->_params['charset'], 'UTF-8'),
             'attribute_type' => empty($attribute['attribute_type'])
                 ? 'text' : $attribute['attribute_type'],
             'attribute_params' => Horde_String::convertCharset(
                 @unserialize($attribute['attribute_params']),
-                $this->_params['charset']),
+                $this->_params['charset'], 'UTF-8'),
             'attribute_required' => (bool)$attribute['attribute_required']);
     }
 
@@ -2510,7 +2510,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $name;
         }
 
-        return Horde_String::convertCharset($name, $this->_params['charset']);
+        return Horde_String::convertCharset($name, $this->_params['charset'], 'UTF-8');
     }
 
     function _getAttributesForType($type = null, $raw = false)
@@ -2548,15 +2548,15 @@ class Whups_Driver_sql extends Whups_Driver {
                     . ' (' . $attribute['type_name'] . ')';
             }
             $attributes[$id]['attribute_name'] = Horde_String::convertCharset(
-                $attribute['attribute_name'], $this->_params['charset']);
+                $attribute['attribute_name'], $this->_params['charset'], 'UTF-8');
             $attributes[$id]['attribute_description'] = Horde_String::convertCharset(
-                $attribute['attribute_description'], $this->_params['charset']);
+                $attribute['attribute_description'], $this->_params['charset'], 'UTF-8');
             $attributes[$id]['attribute_type'] =
                 empty($attribute['attribute_type'])
                 ? 'text' : $attribute['attribute_type'];
             $attributes[$id]['attribute_params'] = Horde_String::convertCharset(
                 @unserialize($attribute['attribute_params']),
-                $this->_params['charset']);
+                $this->_params['charset'], 'UTF-8');
             $attributes[$id]['attribute_required'] =
                 (bool)$attribute['attribute_required'];
         }
@@ -2582,7 +2582,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $names;
         }
 
-        return Horde_String::convertCharset($names, $this->_params['charset']);
+        return Horde_String::convertCharset($names, $this->_params['charset'], 'UTF-8');
     }
 
     function getAttributeInfoForType($type_id)
@@ -2601,14 +2601,14 @@ class Whups_Driver_sql extends Whups_Driver {
             return $info;
         }
 
-        return Horde_String::convertCharset($info, $this->_params['charset']);
+        return Horde_String::convertCharset($info, $this->_params['charset'], 'UTF-8');
     }
 
     function _setAttributeValue($ticket_id, $attribute_id, $attribute_value)
     {
         $db_attribute_value = Horde_String::convertCharset((string)$attribute_value,
-                                                     'UTF-8',
-                                                     $this->_params['charset']);
+                                                           'UTF-8',
+                                                           $this->_params['charset']);
 
         $this->_write_db->autoCommit(false);
         $query = 'DELETE FROM whups_attributes '
@@ -2672,7 +2672,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $attributes;
         }
 
-        return Horde_String::convertCharset($attributes, $this->_params['charset']);
+        return Horde_String::convertCharset($attributes, $this->_params['charset'], 'UTF-8');
     }
 
     function getTicketAttributesWithNames($ticket_id)
@@ -2712,7 +2712,7 @@ class Whups_Driver_sql extends Whups_Driver {
             return $attributes;
         }
 
-        return Horde_String::convertCharset($attributes, $this->_params['charset']);
+        return Horde_String::convertCharset($attributes, $this->_params['charset'], 'UTF-8');
     }
 
     function _getAllTicketAttributesWithNames($ticket_id)
@@ -2738,15 +2738,15 @@ class Whups_Driver_sql extends Whups_Driver {
 
         foreach ($attributes as $id => $attribute) {
             $attributes[$id]['attribute_name'] = Horde_String::convertCharset(
-                $attribute['attribute_name'], $this->_params['charset']);
+                $attribute['attribute_name'], $this->_params['charset'], 'UTF-8');
             $attributes[$id]['attribute_description'] = Horde_String::convertCharset(
-                $attribute['attribute_description'], $this->_params['charset']);
+                $attribute['attribute_description'], $this->_params['charset'], 'UTF-8');
             $attributes[$id]['attribute_type'] =
                 empty($attribute['attribute_type'])
                 ? 'text' : $attribute['attribute_type'];
             $attributes[$id]['attribute_params'] = Horde_String::convertCharset(
                 @unserialize($attribute['attribute_params']),
-                $this->_params['charset']);
+                $this->_params['charset'], 'UTF-8');
             $attributes[$id]['attribute_required'] =
                 (bool)$attribute['attribute_required'];
         }
@@ -2809,7 +2809,7 @@ class Whups_Driver_sql extends Whups_Driver {
                 (string)$user,
                 $type,
                 Horde_String::convertCharset((string)$value, 'UTF-8',
-                                       $this->_params['charset']),
+                                             $this->_params['charset']),
                 (int)$value);
             Horde::logMessage(
                 sprintf('Whups_Driver_sql::updateLog(): query="%s"; values="%s"',
index 56cc913..9d7ce23 100644 (file)
@@ -76,7 +76,7 @@ class Whups_Mail {
         $body_id = $message->findBody();
         if ($body_id) {
             $part = $message->getPart($body_id);
-            $comment .= Horde_String::convertCharset($part->transferDecode(), $part->getCharset());
+            $comment .= Horde_String::convertCharset($part->transferDecode(), $part->getCharset(), 'UTF-8');
         } else {
             $comment .= _("[ Could not render body of message. ]");
         }
index b4c2268..aefab71 100644 (file)
@@ -838,7 +838,7 @@ class Wicked_Driver_sql extends Wicked_Driver {
      */
     function _convertFromDriver($value)
     {
-        return Horde_String::convertCharset($value, $this->getCharset());
+        return Horde_String::convertCharset($value, $this->getCharset(), 'UTF-8');
     }
 
     /**