[dancer-users] character encoding

Attila Bárdi attila.bardi at gmail.com
Wed Dec 18 22:03:14 GMT 2013


Hey,

battila at igornb:~/Dancer/MyWebApp/lib$ ./test_ldap.pl
LdapPerson module is successfully loaded!
displayname: Bárdi Attila
unix perlio
battila at 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 at gmail.com> wrote:

> 2013/12/18 Attila Bárdi <attila.bardi at 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 at igornb:~$  ./test_ldap.pl
>> LdapPerson module is successfully loaded!
>> displayname: Bárdi Attila
>> battila at igornb:~$
>>
>>
>> test.pl:
>>
>>
>>
>>
>> *#!/usr/bin/perl -wuse 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 at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20131218/45769744/attachment.html>


More information about the dancer-users mailing list