[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: UNICODE in OpenLDAP 2.0.11


Adrian Trifu wrote:

My problem is as follows:
I am developing a custom backend to a database and I 'm having problems with german umlaut characters in that database.
But the problem starts right from the DN setting in Outlook, where the CN contains one such special character. The DN string has to be transmitted using UTF-8 (LDAP v3 requires this). Ok, the DN string arrives to the OpenLDAP server but I don't know how to put it back together as WCHARs.
I have tried with MultiByteToWideChar() from Windows but it doesn't come out right.

I do not have too much experience with UNICODE and UTF. Can anybody help me?

By using Perl, this will probably do the trick:

use Net::LDAP;
use Net::LDAP::Entry;
use Unicode::String qw(utf8 latin1 utf16);

From utf8 to iso8859-1:

$sn = utf8($entry->get_value('sn'))->latin1 if ($entry->exists('sn'));

From iso8859-1 to utf8:

  'cn'          => latin1("$cn")->utf8,
  'sn'          => latin1("$sn")->utf8,
  'givenName'   => latin1("$gn")->utf8,

You can get the required modules from the CPAN archive;

Good luck!



Dipl.-Ing. Adrian Trifu <adrian.trifu@fzi.de>
Forschungszentrum Informatik   Haid-und-Neu-Str. 10-14 76131 Karlsruhe
Program Structures (PROST)     Phone: +49 721 9654 638