----- Forwarded message from tom...@em... -----
Date: Tue, 15 May 2001 19:37:21 +0200
To: gb...@po...
From: tom...@em...
Subject: OpenLDAP , PerLdap and UTF 8
X-mailer: Pegasus Mail for Win32 (v3.12c)
Hi !
I had some problems with users DN/CN containing German=20
"Umlaute" like =FC=F6=E4=D6=C4=DC=DF, every bind failed. Finding no reall=
y=20
helpfull comments in the docs, faqs, mailing lists i finally found a=20
solution at least for me.
The points here are=20
-> ldap v3 uses utf8, ldap v2 t61 .Perldap uses v2 as standard.
-> perl 5.6 does support utf8 but the data coming in is probably=20
something like latin1.
So after half a day :
# Pragma to use UTF 8
use utf8;
# convert out gotten username from latin1 to utf8
$user =3D~ tr/\0-\xff//CU;
my $ldap =3D Net::LDAP->new('server',port =3D> "389") or return=20
(undef, "$@") ;
# Binding with version 3 so utf8 is the encoding the server expects
my $result =3D $ldap->bind ( =20
dn =3D> "$user",
password =3D> "$passwd",
version =3D> '3'
);
I dont know if there is a more elegant solution, but the way should=20
be documented somewhere, so other ppl have a chance without=20
going into change files,faqs,docs and mailing lists from=20
perl,openldap and perldap.
greetings and thanx for your module
tom bille
----- End forwarded message -----
|