[dev] Problem sorting out a problem with charset conversion

Jan Schneider jan at horde.org
Sun Nov 16 04:39:18 PST 2003


Zitat von Etienne Goyer <etienne.goyer at linuxquebec.com>:

> Hi,
>
> I have a hook, _prefs_hook_fullname, that grab the full name (cn) of a
> user from LDAP and set the corresping fullname pref accordingly.  It
> work correctly, but I have problem when the full name contain 8 bit
> characters (accent such as é, è, à, etc).  My pref backend driver is
> mysql.
>
> When the Horde portal page appear, the uppermost frame display :
>
> "Welcome, Test accent -?- -?- -?-"
>
> The page encoding is set to UTF-8.  When I change the encoding in my
> browser to ISO-8859-1, the frame become :
>
> "Welcome, Test accent 2 -é- -è- -à-"
>
> Which is what it should be.
>
> IT is my understanding that LDAP return string in UTF-8.  my
> _prefs_hook_fullname does not do any character encoding conversion, it
> just return the cn as provided by LDAP.  So, somewhere between LDAP ->
> MySQL prefs table -> output, this pref is converted from UTF-8 to
> ISO-8859-1 but is not converted back before being displayed.  Could
> this be correct ?  How should I correct, or work-around, that ?

This is what it looks like, yes. But looking at your other problems with
charset conversions, the problem might be anywhere else, though I have no
idea where.

> Thanks for your insight, I have been banging my head at this one for a
> few hours and getting hopeless ... :(

A simple fix for this single case would be to pass the full name that you
retrieved from ldap and that seems to be iso-8859-1 through
String::convertCharset() inside your hook.

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the dev mailing list