Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Net::LDAP and special characters

by LittleGreyCat (Scribe)
on Aug 20, 2008 at 17:45 UTC ( [id://705568]=perlquestion: print w/replies, xml ) Need Help??

LittleGreyCat has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

just a quick question before I scarper for my supper - more information tomorrow if required:

I am using tried and tested code (well, it was using Mozilla::LDAP and has recently been rolled over to Net::LDAP) to add an entry to an LDAP directory

In this case it is an Exchange 5.5 GAL, but the same code is used for a 'real' X.500 directory. I suspect that most of this is irrelevant.

The '$ldap_entry->update' method works fine and my new entry appears in the GAL; there is just one problem. A special character (decimal 167) which is a kind of double 's' in the UTF-8 character set appears to be being stripped out during the LDAP update.

I can see the data in the new LDAP entry before I call the update method, but the data is not making it into the directory, although there is no error code returned.

I was wondering if this was a known feature of Net::LDAP and if I had to do some kind of conversion of the data before I updated the LDAP directory

Any suggestions welcomed; my tea will be even more welcome ;-)

Cheers

LGC

Nothing succeeds like a budgie with no teeth.

Replies are listed 'Best First'.
Re: Net::LDAP and special characters
by LittleGreyCat (Scribe) on Aug 21, 2008 at 10:38 UTC
    From http://ldap.perl.org/FAQ.html.
    Thanks jdtoronto from Re: Net::LDAP information.

    "Most syntaxes used in LDAP however describe text strings rather than binary objects (like JPEGs or certificates.)

    In LDAPv3 most of these syntaxes support Unicode encoded using UTF-8.
    Because the Net::LDAP modules do not change the strings that you pass in as attribute values (they get sent to the LDAP server as-is) to use accented characters you simply need to encode your strings in UTF-8.
    There are modules on CPAN that will help you here.

    Note that LDAPv2 servers used something called T.61 instead of Unicode and UTF-8.
    Most servers do not implement T.61 correctly, and it is recommended that you use LDAPv3 instead."

    So I just have to establish that I am using an LDAPv3 server and find a UTF-8 encoding routine.

    Simple - what can go wrong?

    LGC

    Nothing succeeds like a budgie with no teeth.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://705568]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-16 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found