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

Question by:mruel
  • 3
  • 3
LVL 51

Expert Comment

ID: 6242806
Which LDAP (protocol) version are you using?
Which perl module for LDAP are you using? ( or Netscape
What are the Problems?

Author Comment

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...
LVL 51

Expert Comment

ID: 6249312
I suggest using Net::LDAPapi, it supports UTF8.
I'll check if I find an example, being back soon ...
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

LVL 51

Accepted Solution

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);

Author Comment

ID: 6249879
I'll try this and come back to tell you if it works.

Author Comment

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

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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