Hi list, hi gurus (Graham & Chris ;-),

I am trying to get non-ACII characters in attributes/objects that I get back 
from directories using Net::LDAP correctly encoded in Perl-unicode
(I.e. so that uc("Hägar") results in "HÄGAR" and not in "HäGAR" or even 
errors)
Unfortunately I have not found any solution that worked as I wanted.

Then I tried to take another route:
Why not let Convert::ASN1 do the dirty work of upgrading the UTF8 strings to 
Perl-unicode. For the other direction (sending Perl-uncode chars to LDAP 
directories) it already does it.

Thinking about it a bit longer I came to the conclusion that Convert::ASN1 
might be the wrong place to do it since there may be some discrepancies 
between the ASN1 encoding and the programmers' needs (i.e. sometimes one 
may need to have the raw byte-value of an attribute)
And besides, this change deep in Convert::ASN1 might break applications that 
use Net::LDAP.

So I thought about adding a parameter 'binary' to Net::LDAP->new() and 
Net::LDIF->new() that contains a list / pattern of all the attribute names 
whose values should NOT be upgraded to Perl-unicode.
Then, whenever a search is performed or an LDIF file is read Net::LDAP::Search
and Net::LDIF take care of upgrading the values of the attributes that are not 
in the binary list to Perl-unicode.
(I chose the negative selection 'binary' to get the list shorter, because IMHO 
most anttributes in an LDAP directory are text)

To keep compatibility with existing installations, the presence of
the 'binary' attribute is required for Net::LDAP::Search / Net::LDIF to 
behave the way described above.

What do you think about it ?

Or did I completely miss something very basic and all this stuff above is 
completely unnecessary ?

Peter

-- 
Peter Marschall
eMail: [EMAIL PROTECTED]

Reply via email to