[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: International characters (OpenLDAP v2.0, PHP 4)



>>>>> "Peter" == Peter Marschall <peter.marschall@adpm.de> writes:

    Peter> Hi Turbo,
    Peter> On Sunday 08 June 2003 12:52, Turbo Fredriksson wrote:
    >> I'm trying to improve phpQLAdmin to allow international
    >> characters in RDN.

    Peter> International characters can occur in the rest of the DN
    Peter> too, can't they ?

That's the idea...

    >>  If I don't base64 encode the RDN, but only the 'o' attribute
    >> 'INSIDE' the object like this, it works. Sort of. I can't
    >> SEARCH for the object.

    Peter> You need to convert the international characters to UTF8.

If I do this, PHP/OpenLDAP refuse because of 'Invalid syntax'. Doing
a base64 encoding works.

The new LDIF I'm playing with is a user with the 'cn=Örjan Östlund'
(just to get a national character). UTF8 encoding it will give me the
following output from 'ldapadd':

----- s n i p -----
adding new entry "uid=test2%bayour.com,o=Turbo Fredriksson"
ldap_add: Invalid syntax
        additional info: givenname: value #0 invalid per syntax
----- s n i p -----

And the LDIF looks like:
----- s n i p -----
dn: uid=test2%bayour.com,o=Turbo Fredriksson
uid: test2%bayour.com
givenname: Ãrjan
sn: Ãstlund
accountstatus: active
mail: test2@bayour.com
uidnumber: 500
gidnumber: 500
gecos: Ãrjan Ãstlund
cn: Ãrjan Ãstlund
userpassword: {SHA}qUqP5cyxm6YcTAhz05Hph5gvu9M=
homedirectory: /var/mail/users/test2%bayour.com
mailhost: papadoc.bayour.com
deliverymode: localdelivery
mailmessagestore: /var/mail/users/test2%bayour.com
objectclass: inetorgperson
objectclass: pilotperson
objectclass: posixaccount
objectclass: qmailuser
----- s n i p -----

It don't seem to obvious (in my email client) that sn, givenName, gecos
and cn is UTF8 encoded, but they are (at least I see them in the browser
and 'less').

As said, doing a base64 encode (and then a DEcode when searching) works
most of the time. The 'dc=åäö' branch example in previous mail will be
found if/when doing a base64 encode/decode both from the command line
tool (ldapsearch) and from the PHP script. But this 'Örjan Östlund'
will NOT be found from PHP, only from the shell...

This MUST be a PHP error (since it works with the OpenLDAP 'ldapsearch'
command) so I'll dig deeper. 

Any idea why UTF8 encoding won't work, but BASE64 does?