[dancer-users] character encoding

Attila Bárdi attila.bardi at gmail.com
Wed Dec 18 16:04:12 GMT 2013


Hey Stefan,

as you see the the ldap gives me the correct result, till the Dancer module
is not loaded.
I think it is a Dancer error not an ldap.

I created a more simple test case:

battila at igornb:~$ dancer -a MyWeb::App
...
battila at igornb:~$ cd MyWeb-App
battila at igornb:~/MyWeb-App$ vi lib/ChrachterMistake.pm

#!/usr/bin/perl -w
package ChrachterMistake;
use strict;
use warnings;

sub gimmySomething {
    return "Bárdi Attila";
}

1;

battila at igornb:~/MyWeb-App$ vi lib/MyWeb/App.pm

package MyWeb::App;
use Dancer ':syntax';
use ChrachterMistake;

our $VERSION = '0.1';

get '/' => sub {
    return ChrachterMistake::gimmySomething();
};

true;

battila at igornb:~/MyWeb-App$ perl ./bin/app.pl
[9950]  core @0.000010> loading Dancer::Handler::Standalone handler in
/usr/share/perl5/Dancer/Handler.pm l. 45
[9950]  core @0.000181> loading handler 'Dancer::Handler::Standalone' in
/usr/share/perl5/Dancer.pm l. 474
>> Dancer 1.311 server 9950 listening on http://0.0.0.0:3000
== Entering the development dance floor ...


With browser I connect to the http://localhost:3000/ and the result is:
Bárdi Attila

The Dancer does something with the return value of the function.

No ldap in the chain at all.

Best regards,
Attila


On Wed, Dec 18, 2013 at 4:31 PM, Stefan Hornburg (Racke)
<racke at linuxia.de>wrote:

> On 12/18/2013 03:03 PM, Attila Bárdi wrote:
> > Dear dancers,
> >
> > I have an openldap server and I do some search in there.
> > I wrote a perl module to handle the basic operations in the ldap.
> > 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;my $somebody =
> > LdapPerson->new();$somebody = LdapPerson->search('
> attila.bardi at example.com
> > <attila.bardi at example.com>');print "displayname: " .
> > $somebody->get_displayName() . "\n"*
> >
> > But with: *use Dancer ':syntax';*
> >
> > the "*Bárdi Attila*" become "*Bárdi Attila*"
> >
> > package MyWeb::App;
> > use Dancer ':syntax';
> > use LdapPerson;
> >
> > our $VERSION = '0.1';
> >
> > get '/' => sub {
> >         my $somebody = LdapPerson->new();
> >         $somebody = LdapPerson->search('attila.bardi at example.com');
> >         return $somebody->get_displayName();
> > };
> >
> > true;
> >
> > from config.yml:
> >
> >
> >
> >
> > *# when the charset is set to UTF-8 Dancer will handle for you# all the
> > magic of encoding and decoding. You should not care# about unicode within
> > your app when this setting is set (recommended).charset: "UTF-8"*
> >
> >
> > Can anyone help me what is the problem and how can I solve it?
>
> LDAP + UTF-8 seems to be tricky, as I learned from writing
> Dancer::Plugin::LDAP.
> Maybe you can find some wisdom in its source code?
>
> Regards
>         Racke
>
>
> --
> LinuXia Systems => http://www.linuxia.de/
> Expert Interchange Consulting and System Administration
> ICDEVGROUP => http://www.icdevgroup.org/
> Interchange Development Team
>
> _______________________________________________
> 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/41ea8eff/attachment.html>


More information about the dancer-users mailing list