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

RE: UNICODE in OpenLDAP 2.0.11



Hi again!

Thank you for the quick reply.
My problem is I'm afraid a bit more basic:

How does OpenLDAP support UTF-8? Is it supposed to do any conversions on its own?
For instance, the dn_normalize() function is TOUPPER()-ing the buffer a char at a time... Doesn't that work ONLY for single-byte coded
characters?

I guess my problem can be stated as "How can I develop an OpenLDAP backend in C/C++, under WinNT/2000, which works correctly with umlaut-ed characters?"
Just basic directions would be enough.

I looked into the list archives but I don't seem to be able to manage alone. Also,time is pressing me.

Thanks!


> Hello.
> 
> Adrian Trifu wrote:
> > Hi!
> > 
> > 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:
> 
> $entry->add(
>    'cn'          => latin1("$cn")->utf8,
>    'sn'          => latin1("$sn")->utf8,
>    'givenName'   => latin1("$gn")->utf8,
> );
> 
> You can get the required modules from the CPAN archive;
> 
> Good luck!
>