Summary | _prefs_hook_fullname charset problem |
Queue | Horde Framework Packages |
Queue Version | FRAMEWORK_3 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org |
Requester | frank.richter (at) hrz (dot) tu-chemnitz (dot) de |
Created | 10/13/2008 (6103 days ago) |
Due | |
Updated | 03/19/2009 (5946 days ago) |
Assigned | 03/16/2009 (5949 days ago) |
Resolved | 03/16/2009 (5949 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
State ⇒ Feedback
http://cvs.horde.org/diff.php/framework/Prefs/Prefs.php?rt=horde&r1=1.137.10.40&r2=1.137.10.41&ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&r1=1.515.2.512&r2=1.515.2.513&ty=u
State ⇒ Assigned
New Attachment: prefs-patch
as a separate text file instead of pasting it, so that the linebreaks
are intelligible?
as a separate text file instead of pasting it, so that the linebreaks
are intelligible?
driver charset, but it shouldn't be. Here is a patch:
*** horde-3.2.2/lib/Horde/Prefs.php 2008-09-10 12:31:51.000000000 +0200
--- horde/lib/Horde/Prefs.php 2008-11-04 17:34:11.000000000 +0100
***************
*** 786,792 ****
empty($this->_scopes[$scope][$name]['v']) ||
$this->_scopes[$scope][$name]['m'] & _PREF_DEFAULT) {
$val = Horde::callHook('_prefs_hook_' . $name,
array($this->_user), 'horde', $name);
! $this->_scopes[$scope][$name]['v'] =
$this->convertToDriver($val, NLS::getCharset());
if ($this->_scopes[$scope][$name]['m'] & _PREF_LOCKED) {
$this->_scopes[$scope][$name]['m'] |= _PREF_DIRTY;
}
--- 786,796 ----
empty($this->_scopes[$scope][$name]['v']) ||
$this->_scopes[$scope][$name]['m'] & _PREF_DEFAULT) {
$val = Horde::callHook('_prefs_hook_' . $name,
array($this->_user), 'horde', $name);
! if (($this->_scopes[$scope][$name]['m'] &
_PREF_DEFAULT) == 0) {
! $this->_scopes[$scope][$name]['v'] =
$this->convertToDriver($val, NLS::getCharset());
! } else {
! $this->_scopes[$scope][$name]['v'] = $val;
! }
if ($this->_scopes[$scope][$name]['m'] & _PREF_LOCKED) {
$this->_scopes[$scope][$name]['m'] |= _PREF_DIRTY;
}
is incorrect. Is the question mark literally in the log? And how is
the name supposed to correctly look like?
_callHooks:
the value is converted by convertToDriver($val, NLS::getCharset());
If I omit the convertToDriver call here, and giving the UTF-8 value,
ist works - the database contains the Latin1-value. Is it a "multiple
encoding problem"?
Frank
State ⇒ Feedback
backend. Try:
$outputcharset = $GLOBALS['conf']['sql']['charset'];
instead.
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ _prefs_hook_fullname charset problem
Type ⇒ Bug
Queue ⇒ Horde Framework Packages
I'm migrating from Horde 3.1/IMP 4.1 to 3.3/4.3. We defined a hook for
fullname in horde/config/hooks.php (taken from the example):
if (!function_exists('_prefs_hook_fullname')) {
function _prefs_hook_fullname($user = null)
{
$ldapServer = 'ldap.tu-chemnitz.de';
$ldapPort = '389';
$searchBase = 'dc=tu-chemnitz, dc=de';
$ldapcharset = 'UTF-8';
$outputcharset = NLS::getCharset();
$ds = @ldap_connect($ldapServer, $ldapPort);
if (is_null($user)) {
$user = Auth::getAuth();
if ($user === false)
return '';
}
$searchResult = @ldap_search($ds, $searchBase, 'uid=' . $user);
$information = @ldap_get_entries($ds, $searchResult);
if ($information === false || $information["count"] < 1) return '';
if ($information[0]['displayname'][0] != '') {
$name = $information[0]['displayname'][0];
} else {
$name = $information[0]['cn'][0];
}
ldap_close($ds);
$name = String::convertCharset($name, $ldapcharset, $outputcharset);
Horde::logMessage("fullname: $name, $ldapcharset,
$outputcharset", __FILE__, __LINE__, LOG_DEBUG);
return ($name);
# return (empty($name) ? $user : $name);
}
}
There are problem with names containing umlauts - from the Logfile:
Oct 13 11:48:12 HORDE [debug] [imp] fullname: Ottö Tcshtester, UTF-8,
UTF-8 [pid 15336 on line 192 of "/var/www/html/horde/config/hooks.php"]
Oct 13 11:48:12 HORDE [debug] [imp] fullname: Ottö Tcshtester, UTF-8,
UTF-8 [pid 15336 on line 192 of "/var/www/html/horde/config/hooks.php"]
Oct 13 11:48:12 HORDE [debug] [imp] SQL Query by Prefs_sql::store():
INSERT INTO horde_prefs (pref_uid, pref_scope, pref_name, pref_value)
VALUES(?, ?, ?, ?), values: tcot, horde, identities,
a:1:{i:0;a:5:{s:2:"id";s:17:"Standardidentit�t";s:8:"fullname";s:12:"Ott?shtester";s:9:"from_addr";s:34:"otto.tcshtester@hrz.tu-chemnitz.de";s:10:"alias_addr";a:1:{i:0;s:23:"tcot@hrz.tu-chemnitz.de";}s:10:"default_id";s:1:"0";}} [pid 15336 on line 244 of
"/var/www/html/horde/lib/Horde/Prefs/sql.php"]
The full name doesn't contain the umlaut. Setting the name via the
Webbrowser is ok - umlauts are correctly
This function works in Horde 3.1 Do you have any idea?
Thanks in advance,
Frank