<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>_prefs_hook_fullname charset problem</title> 
  <pubDate>Thu, 09 Apr 2026 21:37:09 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/7489</link> 
  <atom:link rel="self" type="application/rss+xml" title="_prefs_hook_fullname charset problem" href="https://bugs.horde.org/ticket/7489/rss" /> 
  <description>_prefs_hook_fullname charset problem</description> 
 
   
   
  <item> 
   <title>Hi,

I&#039;m migrating from Horde 3.1/IMP 4.1 to 3.3/4.3. We def</title> 
   <description>Hi,

I&#039;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(&#039;_prefs_hook_fullname&#039;)) {

     function _prefs_hook_fullname($user = null)

     {

         $ldapServer = &#039;ldap.tu-chemnitz.de&#039;;

         $ldapPort = &#039;389&#039;;

         $searchBase = &#039;dc=tu-chemnitz, dc=de&#039;;

         $ldapcharset = &#039;UTF-8&#039;;

         $outputcharset = NLS::getCharset();



         $ds = @ldap_connect($ldapServer, $ldapPort);



         if (is_null($user)) {

             $user = Auth::getAuth();

             if ($user === false)

                return &#039;&#039;;

         }

         $searchResult = @ldap_search($ds, $searchBase, &#039;uid=&#039; . $user);

         $information = @ldap_get_entries($ds, $searchResult);

         if ($information === false || $information[&quot;count&quot;] &lt; 1) return &#039;&#039;;

         if ($information[0][&#039;displayname&#039;][0] != &#039;&#039;) {

             $name = $information[0][&#039;displayname&#039;][0];

         } else {

             $name = $information[0][&#039;cn&#039;][0];

         }

         ldap_close($ds);



         $name = String::convertCharset($name, $ldapcharset, $outputcharset);

         Horde::logMessage(&quot;fullname: $name, $ldapcharset, $outputcharset&quot;, __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 &quot;/var/www/html/horde/config/hooks.php&quot;]

Oct 13 11:48:12 HORDE [debug] [imp] fullname: Ottö Tcshtester, UTF-8, UTF-8 [pid 15336 on line 192 of &quot;/var/www/html/horde/config/hooks.php&quot;]

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:&quot;id&quot;;s:17:&quot;Standardidentit&amp;#65533;t&quot;;s:8:&quot;fullname&quot;;s:12:&quot;Ott?shtester&quot;;s:9:&quot;from_addr&quot;;s:34:&quot;otto.tcshtester@hrz.tu-chemnitz.de&quot;;s:10:&quot;alias_addr&quot;;a:1:{i:0;s:23:&quot;tcot@hrz.tu-chemnitz.de&quot;;}s:10:&quot;default_id&quot;;s:1:&quot;0&quot;;}} [pid 15336 on line 244 of &quot;/var/www/html/horde/lib/Horde/Prefs/sql.php&quot;]



The full name doesn&#039;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

</description> 
   <pubDate>Mon, 13 Oct 2008 10:15:38 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t49666</link> 
  </item> 
   
  <item> 
   <title>It&#039;s probably necessary to convert to the charset of the pre</title> 
   <description>It&#039;s probably necessary to convert to the charset of the preference backend. Try:

$outputcharset = $GLOBALS[&#039;conf&#039;][&#039;sql&#039;][&#039;charset&#039;];

instead.</description> 
   <pubDate>Sun, 19 Oct 2008 17:06:24 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t49790</link> 
  </item> 
   
  <item> 
   <title>&gt; $outputcharset = $GLOBALS[&#039;conf&#039;][&#039;sql&#039;][&#039;charset&#039;];



Th</title> 
   <description>&gt; $outputcharset = $GLOBALS[&#039;conf&#039;][&#039;sql&#039;][&#039;charset&#039;];



Thansk, but it doesn&#039;t help. I see in lib/Horde/Prefs.php in function _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 &quot;multiple encoding problem&quot;?



Frank

</description> 
   <pubDate>Mon, 20 Oct 2008 13:15:39 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t49840</link> 
  </item> 
   
  <item> 
   <title>Maybe, but in any case it seems to try to convert from a cha</title> 
   <description>Maybe, but in any case it seems to try to convert from a charset that is incorrect. Is the question mark literally in the log? And how is the name supposed to correctly look like?</description> 
   <pubDate>Fri, 24 Oct 2008 10:59:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t49964</link> 
  </item> 
   
  <item> 
   <title>I had the same problem, hooked default preference is convert</title> 
   <description>I had the same problem, hooked default preference is converted to sql driver charset, but it shouldn&#039;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-&gt;_scopes[$scope][$name][&#039;v&#039;]) ||

                  $this-&gt;_scopes[$scope][$name][&#039;m&#039;] &amp; _PREF_DEFAULT) {

                  $val = Horde::callHook(&#039;_prefs_hook_&#039; . $name, array($this-&gt;_user), &#039;horde&#039;, $name);

!                 $this-&gt;_scopes[$scope][$name][&#039;v&#039;] = $this-&gt;convertToDriver($val, NLS::getCharset());

                  if ($this-&gt;_scopes[$scope][$name][&#039;m&#039;] &amp; _PREF_LOCKED) {

                      $this-&gt;_scopes[$scope][$name][&#039;m&#039;] |= _PREF_DIRTY;

                  }

--- 786,796 ----

                  empty($this-&gt;_scopes[$scope][$name][&#039;v&#039;]) ||

                  $this-&gt;_scopes[$scope][$name][&#039;m&#039;] &amp; _PREF_DEFAULT) {

                  $val = Horde::callHook(&#039;_prefs_hook_&#039; . $name, array($this-&gt;_user), &#039;horde&#039;, $name);

!               if (($this-&gt;_scopes[$scope][$name][&#039;m&#039;] &amp; _PREF_DEFAULT) == 0) {

!                     $this-&gt;_scopes[$scope][$name][&#039;v&#039;] = $this-&gt;convertToDriver($val, NLS::getCharset());

!               } else {

!                   $this-&gt;_scopes[$scope][$name][&#039;v&#039;] = $val;

!               }

                  if ($this-&gt;_scopes[$scope][$name][&#039;m&#039;] &amp; _PREF_LOCKED) {

                      $this-&gt;_scopes[$scope][$name][&#039;m&#039;] |= _PREF_DIRTY;

                  }

</description> 
   <pubDate>Tue, 04 Nov 2008 16:50:46 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t50265</link> 
  </item> 
   
  <item> 
   <title>Can you please re-upload that patch as a unified diff, and a</title> 
   <description>Can you please re-upload that patch as a unified diff, and attach it as a separate text file instead of pasting it, so that the linebreaks are intelligible?</description> 
   <pubDate>Sun, 16 Nov 2008 22:24:00 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t50782</link> 
  </item> 
   
  <item> 
   <title>&gt; Can you please re-upload that patch as a unified diff, and</title> 
   <description>&gt; Can you please re-upload that patch as a unified diff, and attach it 

&gt; as a separate text file instead of pasting it, so that the linebreaks 

&gt; are intelligible?



Sure, here it is.</description> 
   <pubDate>Tue, 18 Nov 2008 13:58:30 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t50838</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/framework/Prefs/Prefs.php?rt=horde&amp;r1=1.137.10.40&amp;r2=1.137.10.41&amp;ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&amp;r1=1.515.2.512&amp;r2=1.515.2.513&amp;ty=u</description> 
   <pubDate>Mon, 16 Mar 2009 12:01:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t53118</link> 
  </item> 
   
  <item> 
   <title>Can you please try the version that I committed?</title> 
   <description>Can you please try the version that I committed?</description> 
   <pubDate>Mon, 16 Mar 2009 12:01:55 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t53119</link> 
  </item> 
   
  <item> 
   <title>Works as per feedback from Petr (lampa).</title> 
   <description>Works as per feedback from Petr (lampa).</description> 
   <pubDate>Mon, 16 Mar 2009 16:53:32 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t53133</link> 
  </item> 
   
  <item> 
   <title>&gt; Can you please try the version that I committed?



Yes, i</title> 
   <description>&gt; Can you please try the version that I committed?



Yes, it works. Thank you!

</description> 
   <pubDate>Thu, 19 Mar 2009 09:15:51 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7489#t53179</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
