Solved

LDAP?

Posted on 2001-06-27
6
476 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
perl search and replace 6 171
collecting information 2 184
ppm conversion to curl on a module install 8 86
quoting a comma separated list 20 87
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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

821 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