asafp has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,
I am using Net::LDAP to authenticate users and get their attributes.
I have a problem with diacritics in the displayName - it seems that LDAP omits part of them. For example:
the name "Krejčíř" becomes "Krejcír" and the name "Kovář" becomes "Kovár".
Is there a way of configuring the Net::LDAP to return the correct names? I couldn't find such in CPAN...
Or is it a built-in problem in LDAP itself?
Thanks,
Asaf

Replies are listed 'Best First'.
Re: UTF-8 in LDAP
by graff (Chancellor) on Dec 22, 2009 at 22:03 UTC
    I don't know enough about LDAP to comment on how it deals with utf8 data, but the pattern of behavior you reported, where certain diacritic marks are preserved (grave accent on the vowels) but others are lost ("caron" accent on consonants), might suggest a problem with "improperly normalized" input text.

    For example, the single character "latin small letter c with caron" (U+010D, č) could also be rendered as a two character sequence: "latin small letter c" (U+0063) followed by "combining caron" (U+030C). This latter form is considered "unnormalized", and is generally frowned upon, but it does show up in places where it might not be expected. If that's the case in your data, it may be that LDAP is ignoring the characters that happen to be combining (non-spacing) marks. (Whether such behavior is warranted, I can't say.)

    If you can, it might help to inspect the input strings in more detail, to see what the actual character sequence is. If it's unnormalized, try using Unicode::Normalize to change that, then see what LDAP does.

    You might also try this script I posted a while back, which can show you exactly what the character sequences are in your data: tlu -- TransLiterate Unicode.