Solved

LDAP?

Posted on 2001-06-27
6
473 Views
Last Modified: 2012-08-13
Is anybody knows LDAP ? I have problems with accents in common names....

Mel
0
Comment
Question by:mruel
  • 3
  • 3
6 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6242806
Which LDAP (protocol) version are you using?
Which perl module for LDAP are you using? (Net::LDAPapi.pm or Netscape LDAPapi.pm).
What are the Problems?
0
 

Author Comment

by:mruel
ID: 6249078
I'm using PerLDAP v1.4 and Mozilla::LDAP.

The problem is that names with accents (Like Melanie Ruel) have been saved in LDAP database and when I try to display them on a HTML page, I have something like "M??lanie Ruel", and when I make a ldapsearch on that name, it says that cn=NOT ASCII.

I found that string are UTF-8 encoded, but I don't know how can I decode the string to obtain Melanie instead of M??lanie...
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6249312
I suggest using Net::LDAPapi, it supports UTF8.
I'll check if I find an example, being back soon ...
 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6249733
here we go
to get a UTF-encoded sring use:

use Unicode::String qw(latin1 utf8);
$isutf8 = latin1($yourstring)->utf8;
# then use ?isutf8 in your search() call.

Depending on the used LDAP verion (I assume you're using Netscape Directory Server), strings containing non-7bit-ASCII characters were base64 encoded automatically and then stored in the directory. You can use then:

use MIME::Base64;
$isbase64 = encode_base64($yourstring);

and decoding then is like:
$yourstring = utf8($isutf8)->latin1;
$yourstribg = decode_base64($isbase64);
0
 

Author Comment

by:mruel
ID: 6249879
Thanks!
I'll try this and come back to tell you if it works.
0
 

Author Comment

by:mruel
ID: 6249926
I tried utf8($yourstring)->latin1; And it worked!
It make me save a lot of time, thanks a lot ahoffmann!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now