From: Chris R. <chr...@me...> - 2002-04-09 09:45:53
|
> Hi, >=20 > Does perl-ldap support special characters (like =E9 =E8 '=E0...) when creating > entries in a directory (openldap). > One solution is using Base64 encoding, is there another way to manage thi= s > kind of character >=20 > Thank you. >=20 LDAPv3 supports using UTF-8 encoded strings for most attributes, so if you have a server that supports LDAPv3, and have bound to the directory using LDAPv3 (NB the default in perl-ldap is to bind using v2) then you should simply pass UTF-8 encoded strings into the Net::LDAP methods. Recent versions of perl (5.6 or above) have UTF-8 support built-in; older versions of perl can get some UTF-8 modules from CPAN (<http://search.cpan.org/>). You can find out how to encode accented characters by looking at the character tables at the Unicode Consortium (<http://www.unicode.org/>), and UTF-8 is defined by RFC 2279 (<http://www.ietf.org/rfc/rfc2279.txt>) Using base64 is *not* a solution - it only works by fooling the server that it needs to store a different set of characters which happen to be a (subse= t of) ASCII. It means that the server cannot use the proper matching rules on those values, like equality and substring and approximate, so you're really losing a lot of functionality by doing this. If you *aren't* binding using LDAPv3 and don't want to/can't for some reason, then you need to find out what character sets your server supports for LDAPv2. The LDAPv2 standards say you MUST use the T.61 character set, but almost no-one does. (Because of that, you are strongly advised to not use LDAPv2.) Cheers, Chris |