Hey,

battila@igornb:~/Dancer/MyWebApp/lib$ ./test_ldap.pl 
LdapPerson module is successfully loaded!
displayname: Bárdi Attila
unix perlio
battila@igornb:~/Dancer/MyWebApp/lib$ 

Hmml, there is no utf8. 

I found the following while I search for the solution and before I read you e-mail:
the ldap does not set the utf8 flag (I don't know why) so I tried to ask it to set the flag.
I used the raw => qr/(?i:^jpegPhoto|;binary)/ option at the bind, but it just confused the thing, because it converted to utf8.
I also tried to use several utf8, unicode modules without success.

But I don't know the solution.


On Wed, Dec 18, 2013 at 10:00 PM, WK <wanradt@gmail.com> wrote:
2013/12/18 Attila Bárdi <attila.bardi@gmail.com>
 
I have an openldap server and I do some search in there.

So when I search for for example to my displayName, the ldap modul found the following:

battila@igornb:~$  ./test_ldap.pl
LdapPerson module is successfully loaded!
displayname: Bárdi Attila
battila@igornb:~$


test.pl:
#!/usr/bin/perl -w
use strict;
use warnings;
use LdapPerson;

Don't you get any "wide character" warnings? 

As far as I understand you have problem with decoding your input from LDAP. 

When you use your module without Dancer you seem not decode your input and Perl treats your input by bytes and on print it outputs these same bytes. So, when you have UTF-8 enabled environment those bytes are shown as right characters even when they are not meant as such.

Now, using Dancer you tell explicitly to use UTF-8 and because your input is not decoded properly (not marked as UTF-8) Dancer will treat this string as Latin1 and decodes bytes after ASCII-set again to its inner Unicode and on printing again to UTF-8. This causes such output as you have.

You could add to your test.pl one line to test your output filters:

print join( ' ', PerlIO::get_layers('STDOUT') ), "\n";

If the last filter is not "utf8", my conclusion should be right.

-- 
Wbr,
Kőike hääd,

Gunnar

_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users