Solved

LDAP?

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

Mel
0
Comment
Question by:mruel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…

734 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