From 84d1957888a5772fe5b9df2be4408e2ee7950345 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sun, 3 Oct 2010 01:49:40 +0200 Subject: [PATCH] Require the server and client to required UTF-8. Remove setCharset(), setCharsetEnvironment(), getExternalCharset(). --- ansel/scripts/recursive_import.php | 1 - folks/scripts/mail-filter.php | 4 - framework/Core/lib/Horde/Core/Factory/Crypt.php | 1 - framework/Core/lib/Horde/Registry.php | 101 +-------------------- framework/Crypt/lib/Horde/Crypt.php | 3 - framework/Crypt/lib/Horde/Crypt/Pgp.php | 11 ++- .../lib/Horde/Kolab/Filter/Configuration.php | 2 - .../examples/Horde/Kolab/Format/event.php | 2 - .../examples/Horde/Kolab/Format/new_type.php | 2 - .../Horde/Kolab/Format/Integration/ContactTest.php | 10 -- .../Horde/Kolab/Format/Integration/EventTest.php | 13 --- .../Kolab/Format/Integration/MimeAttrTest.php | 10 -- .../Kolab/Format/Integration/PreferencesTest.php | 11 --- .../Kolab/Format/Integration/RecurrenceTest.php | 2 - .../Horde/Kolab/Format/Integration/XmlTest.php | 11 --- .../Kolab_Resource/lib/Horde/Kolab/Resource.php | 3 - .../Kolab/Storage/Class/Driver/CclientTest.php | 2 - .../Horde/Kolab/Storage/Class/Driver/ImapTest.php | 2 - .../Horde/Kolab/Storage/Class/Driver/MockTest.php | 2 - .../Horde/Kolab/Storage/Class/Driver/PearTest.php | 2 - .../test/Horde/Kolab/Storage/NamespaceTest.php | 2 - .../test/Horde/Kolab/Storage/Server/DriverTest.php | 3 - framework/Rpc/lib/Horde/Rpc/Jsonrpc.php | 12 --- framework/Rpc/lib/Horde/Rpc/Soap.php | 2 - framework/SyncML/SyncML/Backend/Horde.php | 16 ---- framework/SyncML/tests/testsync.php | 2 - framework/Util/lib/Horde/String.php | 18 +--- imp/lib/Compose.php | 6 +- imp/lib/LoginTasks/Task/RenameSentmailMonthly.php | 2 +- imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php | 8 -- kronolith/fb.php | 3 - whups/scripts/mail-filter.php | 4 - 32 files changed, 19 insertions(+), 254 deletions(-) diff --git a/ansel/scripts/recursive_import.php b/ansel/scripts/recursive_import.php index 820f056d8..164535069 100755 --- a/ansel/scripts/recursive_import.php +++ b/ansel/scripts/recursive_import.php @@ -85,7 +85,6 @@ if (!empty($order) && $order != 'date' && $order != 'name' && $order != 'random' exit; } -$registry->setCharset('utf-8'); $gallery_id = processDirectory($dir); if (!$keepEmpties) { $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); diff --git a/folks/scripts/mail-filter.php b/folks/scripts/mail-filter.php index a14e777d4..dd3695eec 100644 --- a/folks/scripts/mail-filter.php +++ b/folks/scripts/mail-filter.php @@ -87,10 +87,6 @@ foreach (array('host', 'user', 'pass', 'port', 'protocol', 'folder') as $opt) { } } -// Set charset to UTF-8 for most flexible conversion between email charset and -// backend charset. -$registry->setCharsetEnvironment('UTF-8'); - // Read and parse the message. $messages = array(); $imap = @imap_open(sprintf('{%s:%d/%s}%s', diff --git a/framework/Core/lib/Horde/Core/Factory/Crypt.php b/framework/Core/lib/Horde/Core/Factory/Crypt.php index 7168f24d3..58b7cfc33 100644 --- a/framework/Core/lib/Horde/Core/Factory/Crypt.php +++ b/framework/Core/lib/Horde/Core/Factory/Crypt.php @@ -60,7 +60,6 @@ class Horde_Core_Factory_Crypt $params = array_merge(array( 'charset' => $registry->getCharset(), 'email_charset' => $registry->getEmailCharset(), - 'external_charset' => $registry->getExternalCharset(), 'temp' => Horde::getTempDir() ), $params); diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 8fbe211bf..33b1d7c2d 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -2160,59 +2160,12 @@ class Horde_Registry */ public function getCharset($original = false) { - /* Get cached results. */ - $cacheKey = intval($original); - $charset = $this->_cachedCharset($cacheKey); - if (!is_null($charset)) { - return $charset; - } - if ($original) { - $charset = empty($this->nlsconfig['charsets'][$GLOBALS['language']]) + return empty($this->nlsconfig['charsets'][$GLOBALS['language']]) ? 'ISO-8859-1' : $this->nlsconfig['charsets'][$GLOBALS['language']]; - } elseif ($GLOBALS['browser']->hasFeature('utf') && - (Horde_Util::extensionExists('iconv') || - Horde_Util::extensionExists('mbstring'))) { - $charset = 'UTF-8'; - } - - if (is_null($charset)) { - $charset = $this->getExternalCharset(); - } - - $this->_cachedCharset($cacheKey, $charset); - - return $charset; - } - - /** - * Returns the current charset of the environment - * - * @return string The character set that should be used with the current - * locale settings. - */ - public function getExternalCharset() - { - /* Get cached results. */ - $charset = $this->_cachedCharset(2); - if (!is_null($charset)) { - return $charset; - } - - $lang_charset = setlocale(LC_ALL, 0); - if ((strpos($lang_charset, ';') === false) && - (strpos($lang_charset, '/') === false)) { - $lang_charset = explode('.', $lang_charset); - if ((count($lang_charset) == 2) && !empty($lang_charset[1])) { - $this->_cachedCharset(2, $lang_charset[1]); - return $lang_charset[1]; - } } - - return empty($this->nlsconfig['charsets'][$GLOBALS['language']]) - ? 'ISO-8859-1' - : $this->nlsconfig['charsets'][$GLOBALS['language']]; + return 'UTF-8'; } /** @@ -2311,37 +2264,6 @@ class Horde_Registry } /** - * Sets the UI charset. - * - * In general, the applied charset is automatically determined by browser - * language and browser capabilities and there's no need to manually call - * setCharset. However for headless (RPC) operations the charset may be - * set manually to ensure correct character conversion in the backend. - * - * @param string $charset The new UI charset. - */ - public function setCharset($charset) - { - $this->_cachedCharset(0, $charset); - } - - /** - * Sets the charset and reloads the whole NLS environment. - * - * When setting the charset, the gettext catalogs have to be reloaded too, - * to match the new charset, among other things. This method takes care of - * all this. - * - * @param string $charset The new UI charset. - */ - public function setCharsetEnvironment($charset) - { - unset($GLOBALS['language']); - $this->setCharset($charset); - $this->setLanguageEnvironment(); - } - - /** * Sets the language. * * @param string $lang The language abbreviation. @@ -2364,22 +2286,8 @@ class Horde_Registry } $GLOBALS['language'] = $lang; - /* First try language with the current charset. */ - $lang_charset = $lang . '.' . $this->getCharset(); - if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { - /* Next try language with its default charset. */ - $charset = empty($this->nlsconfig['charsets'][$lang]) - ? 'ISO-8859-1' - : $this->nlsconfig['charsets'][$lang]; - $lang_charset = $lang . '.' . $charset; - $this->_cachedCharset(0, $charset); - if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { - /* At last try language solely. */ - $lang_charset = $lang; - setlocale(LC_ALL, $lang_charset); - } - } - + $lang_charset = $lang . '.UTF-8'; + setlocale(LC_ALL, $lang_charset); @putenv('LC_ALL=' . $lang_charset); @putenv('LANG=' . $lang_charset); @putenv('LANGUAGE=' . $lang_charset); @@ -2407,7 +2315,6 @@ class Horde_Registry $app, $this->get('fileroot', $app) . '/locale' ); - Horde_String::setDefaultCharset($this->getCharset()); } /** diff --git a/framework/Crypt/lib/Horde/Crypt.php b/framework/Crypt/lib/Horde/Crypt.php index 7a00caf15..46b7e0f2b 100644 --- a/framework/Crypt/lib/Horde/Crypt.php +++ b/framework/Crypt/lib/Horde/Crypt.php @@ -71,8 +71,6 @@ class Horde_Crypt * DEFAULT: NONE * 'email_charset' - (string) The default email charset. * DEFAULT: NONE - * 'external_charset' - (string) The default external charset. - * DEFAULT: NONE * 'temp' - (string) [REQUIRED] Location of temporary directory. * * @@ -89,7 +87,6 @@ class Horde_Crypt $this->_params = array_merge(array( 'charset' => null, 'email_charset' => null, - 'external_charset' => null, ), $params); } diff --git a/framework/Crypt/lib/Horde/Crypt/Pgp.php b/framework/Crypt/lib/Horde/Crypt/Pgp.php index a2ae2e85f..ff41e75e1 100644 --- a/framework/Crypt/lib/Horde/Crypt/Pgp.php +++ b/framework/Crypt/lib/Horde/Crypt/Pgp.php @@ -938,7 +938,16 @@ class Horde_Crypt_Pgp extends Horde_Crypt if ($errno == 0) { throw new Horde_Crypt_Exception(_("Connection refused to the public keyserver.")); } else { - throw new Horde_Crypt_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, $this->_params['external_charset']), $errno)); + $charset = 'UTF-8'; + $lang_charset = setlocale(LC_ALL, 0); + if ((strpos($lang_charset, ';') === false) && + (strpos($lang_charset, '/') === false)) { + $lang_charset = explode('.', $lang_charset); + if ((count($lang_charset) == 2) && !empty($lang_charset[1])) { + $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)); } } diff --git a/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Configuration.php b/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Configuration.php index 2d04d4672..001a3d630 100644 --- a/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Configuration.php +++ b/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Configuration.php @@ -109,8 +109,6 @@ class Horde_Kolab_Filter_Configuration require_once $values['config']; } - Horde_Nls::setCharset('utf-8'); - if (!empty($conf['kolab']['filter']['locale_path']) && !empty($conf['kolab']['filter']['locale'])) { Horde_Nls::setTextdomain('Kolab_Filter', $conf['kolab']['filter']['locale_path'], Horde_Nls::getCharset()); diff --git a/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php b/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php index f935b241e..63f13096c 100644 --- a/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php +++ b/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php @@ -16,8 +16,6 @@ */ require_once 'Horde/Autoloader.php'; -$registry->setCharset('utf-8'); - /** Generate the format handler */ $format = Horde_Kolab_Format::factory('Xml', 'Event'); diff --git a/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php b/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php index 839546b13..55c11df66 100644 --- a/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php +++ b/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php @@ -60,8 +60,6 @@ class Horde_Kolab_Format_Xml_String extends Horde_Kolab_Format_Xml } } -$registry->setCharset('utf-8'); - /** Generate the format handler */ $format = Horde_Kolab_Format::factory('Xml', 'String'); diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php index acfdbdb7d..f8a30b2df 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php @@ -36,16 +36,6 @@ class Horde_Kolab_Format_Integration_ContactTest extends PHPUnit_Framework_TestCase { /** - * Set up testing. - * - * @return NULL - */ - protected function setUp() - { - $GLOBALS['registry']->setCharset('utf-8'); - } - - /** * Test storing single mail addresses. * * @return NULL diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php index 7872c173f..8241ff424 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php @@ -35,19 +35,6 @@ require_once dirname(__FILE__) . '/../Autoload.php'; class Horde_Kolab_Format_Integration_EventTest extends PHPUnit_Framework_TestCase { - - /** - * Set up testing. - * - * @return NULL - */ - protected function setUp() - { - $GLOBALS['registry']->setCharset('utf-8'); - Horde_String::setDefaultCharset('iso-8859-1'); - } - - /** * Test for https://www.intevation.de/roundup/kolab/issue3525 * diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php index fd2b28b8e..773805f2c 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php @@ -36,16 +36,6 @@ class Horde_Kolab_Format_Integration_MimeAttrTest extends PHPUnit_Framework_TestCase { /** - * Set up testing. - * - * @return NULL - */ - protected function setUp() - { - $GLOBALS['registry']->setCharset('utf-8'); - } - - /** * Test retrieving the document name. * * @return NULL diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php index 9281a45e7..22478f7bf 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php @@ -36,17 +36,6 @@ require_once 'Horde/Autoloader.php'; class Horde_Kolab_Format_Integration_PreferencesTest extends PHPUnit_Framework_TestCase { - - /** - * Set up testing. - * - * @return NULL - */ - protected function setUp() - { - $GLOBALS['registry']->setCharset('utf-8'); - } - /** * Test preferences format conversion. * diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php index aea4e5a7f..06fed7612 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php @@ -49,8 +49,6 @@ extends PHPUnit_Framework_TestCase $this->markTestSkipped('The Horde_Date_Recurrence class is missing.'); } - $GLOBALS['registry']->setCharset('utf-8'); - $this->_oldTimezone = date_default_timezone_get(); date_default_timezone_set('Europe/Berlin'); } diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php index 2bf0d2bdb..a6615fdd0 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php @@ -36,17 +36,6 @@ class Horde_Kolab_Format_Integration_XmlTest extends PHPUnit_Framework_TestCase { /** - * Set up testing. - * - * @return NULL - */ - protected function setUp() - { - $GLOBALS['registry']->setCharset('utf-8'); - } - - - /** * Check the preparation of the basic XML structure * * @return NULL diff --git a/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php b/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php index 5d8f0c254..5b8dc115c 100644 --- a/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php +++ b/framework/Kolab_Resource/lib/Horde/Kolab/Resource.php @@ -28,9 +28,6 @@ require_once 'Horde/Kolab/Resource/Itip.php'; require_once 'Horde/Kolab/Resource/Reply.php'; require_once 'Horde/Kolab/Resource/Freebusy.php'; -require_once 'Horde/String.php'; -Horde_String::setDefaultCharset('utf-8'); - // What actions we can take when receiving an event request define('RM_ACT_ALWAYS_ACCEPT', 'ACT_ALWAYS_ACCEPT'); define('RM_ACT_REJECT_IF_CONFLICTS', 'ACT_REJECT_IF_CONFLICTS'); diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php index 9bc596255..31a4ad7eb 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php @@ -42,7 +42,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Cclient( $this->group, array() @@ -55,7 +54,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Cclient( $this->group, array() diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php index a47e191aa..086ebd22e 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php @@ -42,7 +42,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Imap( $this->_getNamespaceMock(), $this->group, @@ -56,7 +55,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Imap( $this->_getNamespaceMock(), $this->group, diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php index 0f6b440f8..1874891ca 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php @@ -58,7 +58,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Mock( $this->group, array() @@ -71,7 +70,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Mock( $this->group, array() diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php index 517e0e696..3be949ef2 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php @@ -42,7 +42,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Pear( $this->_getNamespaceMock(), $this->group, @@ -56,7 +55,6 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Pear( $this->_getNamespaceMock(), $this->group, diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php index 3d0784e00..8c01b02ce 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php @@ -72,7 +72,6 @@ class Horde_Kolab_Storage_NamespaceTest extends PHPUnit_Framework_TestCase public function testFolderTitleConvertsUtf7() { - $GLOBALS['registry']->setCharset('UTF8'); foreach ($this->_getNamespaces() as $namespace) { $name = Horde_String::convertCharset('äöü', 'UTF8', 'UTF7-IMAP'); $folder = $this->_getFolder('INBOX/' . $name, $namespace); @@ -190,7 +189,6 @@ class Horde_Kolab_Storage_NamespaceTest extends PHPUnit_Framework_TestCase public function testSetnameConvertsToUtf7() { - $GLOBALS['registry']->setCharset('UTF8'); foreach ($this->_getNamespaces() as $namespace) { $folder = $this->_getFolder(null, $namespace); $folder->restore($this->_storage, $this->_connection); diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php index d08c32949..87d228e62 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php @@ -47,9 +47,6 @@ class Horde_Kolab_Storage_Server_DriverTest extends PHPUnit_Framework_TestCase return; } - /** @todo: FIXME -> required for namespace handling */ - $GLOBALS['registry']->setCharset('UTF8'); - /** Setup group handler */ require_once 'Horde/Group.php'; require_once 'Horde/Group/mock.php'; diff --git a/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php b/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php index d336bf19a..dc259316f 100644 --- a/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php +++ b/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php @@ -26,18 +26,6 @@ class Horde_Rpc_Jsonrpc extends Horde_Rpc { /** - * Constructor. - * - * @param array $config A hash containing any additional configuration or - * connection parameters this class might need. - */ - function __construct($request, $params = array()) - { - parent::__construct($request, $params); - $GLOBALS['registry']->setCharsetEnvironment('UTF-8'); - } - - /** * Returns the Content-Type of the response. * * @return string The MIME Content-Type of the RPC response. diff --git a/framework/Rpc/lib/Horde/Rpc/Soap.php b/framework/Rpc/lib/Horde/Rpc/Soap.php index 9950edea1..34ca8dd9f 100644 --- a/framework/Rpc/lib/Horde/Rpc/Soap.php +++ b/framework/Rpc/lib/Horde/Rpc/Soap.php @@ -48,8 +48,6 @@ class Horde_Rpc_Soap extends Horde_Rpc */ public function __construct($request, $params = array()) { - $GLOBALS['registry']->setCharset('UTF-8'); - parent::__construct($request, $params); if (!empty($params['allowedTypes'])) { diff --git a/framework/SyncML/SyncML/Backend/Horde.php b/framework/SyncML/SyncML/Backend/Horde.php index 96e258df8..55baba839 100644 --- a/framework/SyncML/SyncML/Backend/Horde.php +++ b/framework/SyncML/SyncML/Backend/Horde.php @@ -34,22 +34,6 @@ class SyncML_Backend_Horde extends SyncML_Backend { } /** - * Sets the charset. - * - * All data passed to the backend uses this charset and data returned from - * the backend must use this charset, too. - * - * @param string $charset A valid charset. - */ - function setCharset($charset) - { - parent::setCharset($charset); - - $GLOBALS['registry']->setCharset($this->getCharset()); - Horde_String::setDefaultCharset($this->getCharset()); - } - - /** * Sets the user used for this session. * * @param string $user A user name. diff --git a/framework/SyncML/tests/testsync.php b/framework/SyncML/tests/testsync.php index 4678bcbe5..7b1e3223e 100755 --- a/framework/SyncML/tests/testsync.php +++ b/framework/SyncML/tests/testsync.php @@ -88,8 +88,6 @@ require_once 'SyncML/Backend.php'; if ($syncml_backend_driver == 'Horde') { require_once dirname(__FILE__) . '/../../../lib/Application.php'; Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true, 'session_control' => 'none')); - Horde_String::setDefaultCharset('UTF-8'); - $registry->setCharset('UTF-8'); } if (!empty($testsetuponly)) { diff --git a/framework/Util/lib/Horde/String.php b/framework/Util/lib/Horde/String.php index 076cdc4a5..4be30bcab 100644 --- a/framework/Util/lib/Horde/String.php +++ b/framework/Util/lib/Horde/String.php @@ -20,7 +20,7 @@ class Horde_String * * @var string */ - static protected $_charset = 'iso-8859-1'; + static protected $_charset = 'UTF-8'; /** * lower() cache. @@ -37,22 +37,6 @@ class Horde_String static protected $_uppers = array(); /** - * Sets a default charset that the methods will use if none is explicitly - * specified. - * - * @param string $charset The charset to use as the default one. - */ - static public function setDefaultCharset($charset) - { - self::$_charset = $charset; - if (Horde_Util::extensionExists('mbstring')) { - $old_error = error_reporting(0); - mb_regex_encoding(self::_mbstringCharset($charset)); - error_reporting($old_error); - } - } - - /** * Converts a string from one charset to another. * * Works only if either the iconv or the mbstring extension diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 7c4a0de37..1f302826e 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -2175,13 +2175,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), $GLOBALS['registry']->getExternalCharset()), + '/%d/' => Horde_String::convertCharset(strftime("%a, %d %b %Y", $udate), 'UTF-8'), /* Date in locale's default. */ - '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), $GLOBALS['registry']->getExternalCharset()), + '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), 'UTF-8'), /* Date and time in locale's default. */ - '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), $GLOBALS['registry']->getExternalCharset()), + '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), 'UTF-8'), /* Message-ID. */ '/%m/' => $message_id, diff --git a/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php b/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php index cec5e4bd1..5f7156fad 100644 --- a/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php +++ b/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php @@ -101,7 +101,7 @@ class IMP_LoginTasks_Task_RenameSentmailMonthly extends Horde_LoginTasks_Task $text = (substr($GLOBALS['language'], 0, 2) == 'en') ? strtolower(strftime('-%b-%Y', $last_maintenance)) : strftime('-%m-%Y', $last_maintenance); - return $folder . Horde_String::convertCharset($text, $GLOBALS['registry']->getExternalCharset(), 'UTF7-IMAP'); + return $folder . Horde_String::convertCharset($text, 'UTF-8', 'UTF7-IMAP'); } } diff --git a/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php b/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php index e3187f2e4..62e4ce22b 100644 --- a/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php +++ b/imp/lib/tests/Imp/Unit/Mime/Viewer/ItipTest.php @@ -67,9 +67,6 @@ extends PHPUnit_Framework_TestCase $registry->expects($this->any()) ->method('getCharset') ->will($this->returnCallback(array($this, '_registryGetCharset'))); - $registry->expects($this->any()) - ->method('setCharset') - ->will($this->returnCallback(array($this, '_registrySetCharset'))); $GLOBALS['registry'] = $registry; $GLOBALS['conf']['server']['name'] = 'localhost'; @@ -167,11 +164,6 @@ extends PHPUnit_Framework_TestCase return $this->_registryCharset; } - public function _registrySetCharset($charset) - { - $this->_registryCharset = $charset; - } - /* Begin tests */ public function testAcceptingAnInvitationResultsInReplySent() diff --git a/kronolith/fb.php b/kronolith/fb.php index 9f324fd4c..19dc288c5 100644 --- a/kronolith/fb.php +++ b/kronolith/fb.php @@ -12,9 +12,6 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'session_control' => 'none')); -// We want to always generate UTF-8 iCalendar data. -$registry->setCharset('UTF-8'); - // Determine the username to show free/busy time for. $cal = Horde_Util::getFormData('c'); $user = Horde_Util::getFormData('u'); diff --git a/whups/scripts/mail-filter.php b/whups/scripts/mail-filter.php index e212dc203..777442fa2 100755 --- a/whups/scripts/mail-filter.php +++ b/whups/scripts/mail-filter.php @@ -154,10 +154,6 @@ if (empty($info['ticket'])) { } } -// Set charset to UTF-8 for most flexible conversion between email charset and -// backend charset. -$registry->setCharsetEnvironment('UTF-8'); - // Read and parse the message. if (empty($mail['user'])) { $result = Whups_Mail::processMail($cli->readStdin(), $info); -- 2.11.0