Re: Manage IA5strings with Perl LDAP

Chris Ridd <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
On 27 Nov 2008, at 15:58, Clément OUDOT wrote:

>>
>> On Nov 26, 2008, at 4:28 AM, Clément OUDOT wrote:
>>> Thanks for your answer. I have to translate java code to perl ;) But
>>> another question, it seems the value we get from AD is binary, I use
>>> the
>>> "raw" attribute in Net::LDAP search but the value I get is not what
>>> I can
>>> see with an ldapsearch... Is there a better way to manage binary
>>> data in
>>> perl-ldap ?
>>
>> ldapsearch is outputing in LDIF and binary data will be base64
>> encoded. You can tell this by the double : after the attribute name
>>
>> you should see the same result if you use Net::LDAP::LDIF to output
>> your entry
>>
>> my $ldif = Net::LDAP::LDIF->new('-','w');
>> $ldif->write_entry($entry);
>
>
> Yes you are right!
>
> The problem is now that the value is outputed as utf-8, and if you  
> want to
> manage such attribute, you have to convert it into bytes :
> http://www.ahfb2000.com/webmaster_help_desk/showthread.php?t=4735
>
> This page helps me to convert the utf-8 into hexadecimal. Then you can
> easily transform hexa to binary.
>
> Did someone on this list use this kind of attributes in his perl code?

The rfc822mailbox (aka "mail") attribute uses the IA5string syntax. I  
bet a few people use that attribute.

Cheers,

Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.