From: R. R. <ren...@cp...> - 2001-06-19 09:32:17
|
Chris Ridd wrote: > >> So basically everything that you pass into Net::LDAP objects *must* be > >> ASCII or UTF-8 (if you are using LDAPv3.) > > I know that. The question is, _where_ excatly do I need to convert (back > > and forth) ? > > I think I said - every value you pass into Net::LDAP from your program and > every value you get out again. Since Net::LDAP doesn't mess around with > values at all, the bytes you pass in should ultimately end up 'on the wire'. Ah... sorry for my "ignorance". So - when I understand you correctly - all I have to do is to pass EBCDIC converted strings to every Net::LDAP subroutine (like bind, search etc.) instead of their ASCII counterparts... correct ? And the way back is to convert to EBCDIC as soon as I want to _work_ with the results on the 390 system. also correct ? > >> I really don't know anything at all about perl on the 390, so this might > >> be a stupid question: what character set is used in the variables in your > >> program? > > It's EBCDIC, which (in more "standardized" form) is "IBM-1047" (as > > opposed to "ISO8859-1", which is ASCII). > > ISO 8859-1 is not ASCII. There is an overlap, but ASCII is only a 7-bit > character set and Latin-1 defines 8-bit characters. Ok. > But I guess your ISO 8859-1 converter will convert ASCII values correctly, > since ISO 8859-1 is mostly a superset of ASCII. I think so as well. > >From your original message to Graham: > > 1: #!/usr/local/bin/perl > > 2: use Net::LDAP; > > 3: $ldap = Net::LDAP->new('ldapsrv.ourdomain.com') or die "$@"; > > Add debug => 12 after the hostname to get protocol debugging. This may help > us a lot. Maybe debug => 3 is more useful, as it gives us plain hex. Will do that ! Thanks for the tip... > > 4: $ldap->bind(dn => 'cn=Directory Manager, o=OurCustomer', > > That dn will need to be converted into ASCII. Yep, I think I understand now... > > 5: password => 'xxxxxxxx'); > > That's tricky. The password syntax is OCTET STRING, which means 'just the > bytes, no character set is implied' so whatever the directory server thinks > the bytes are is needed here. Hmmmm... I should perhaps try an anonymous bind at first. > > 6: $mesg = $ldap->search(base => "o=OurCustomer", > > That search base needs changing to ASCII. > > 7: filter => "(uid=*)"); > > That filter needs changing to ASCII. > > > 8: $ldap->unbind; > > 9: $mesg->code && die $mesg->error; > > 10: foreach $entry ($mesg->all_entries) { $entry->dump; } > > For testing, the dump() method's OK but for real use you'll need to convert > all the values you get back from ASCII into EBCDIC. Yes, of course ! > I'm guessing that you will want to use umlauts etc in your directory, in > which case I would strongly recommend using LDAPv3 if possible - you need > to explicitly request this in the bind operation - as then all values are > UTF-8. > > You should do that because many LDAP servers handle character sets wrongly > (more importantly, differently) when using LDAPv2, so your code will then > not depend on the possibly non-standard behaviour of a particular LDAP > server. > > (So whereever I said ASCII above, I mean UTF-8.) Ok, thanks for all the infos ! I'll keep you informed... Regards, Rene -- R. Reucher voice: +49/621/4803-174 COMPAREX GmbH, VL40 fax: +49/621/4803-141 Mannheimerstr. 105 e-mail: ren...@cp... D-68535 Edingen-Neckarhausen |