Re: [Catalyst] Double encoding of UTF8 strings - RESOLVED
2011/10/9 Oliver Gorwits oli...@cpan.org: On 07/10/2011 10:21, jul@gmail.com wrote: I have installed and ran successfully the AutoCRUD plugin, I set up a mysql database tables to use UT8 charset, the charset in the ajax requests is utf-8, everything seems correct, except the data in the grids are double encoded, that means é instead of é. After some investigation and poking around in documentation I found that the following is essential to using Unicode in Catalyst apps: 1) tell your database connection to use unicode (this will be a flag in the connect options, alongside your username, password, etc). 2) load the Catalyst::Plugin::Unicode::Encoding plugin. These ensure that data is flagged correctly when moving in both directions between the database and the user interface. Acknowledgment must go the author(s) of the following pages: http://wiki.catalystframework.org/wiki/tutorialsandhowtos/using_unicode https://metacpan.org/module/DBIx::Class::Manual::Cookbook#Using-Unicode The wiki page tells you the flag to use for each of the popular database engines (I only tested with SQLite). I hope this helps you Julien, and also the list archives! Works perfectly well. Thanks! I knew the bug was between the keyboard and the chair... -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Plugin::AutoCRUD 2.x and ExtJS 4
2011/10/9 Oliver Gorwits oli...@cpan.org: On 07/10/2011 16:11, jul@gmail.com wrote: I tried to run it with the 2.x Trial (same code, same config, only changing the AutoCRUD modules), and I have the following error : Caught exception in TestUTF8::Controller::AutoCRUD::Root-err_message Use of uninitialized value in exists at /usr/local/share/perl/5.10.1/Catalyst/Plugin/AutoCRUD/Controller/Root.pm line 158. The config with the app isn't right, which is why AutoCRUD exploded. Sure, it shouldn't do that, so I have another thing to fix :) But to get the app running, comment out the Model::AutoCRUD::DBIC config key entirely. You already provide DB connection info within the DB.pm Model. This is Scenario 1. from the documentation. (of course if you want to customize AutoCRUD then the key needs to be there only without the connection/schema info) regards, oliver. Thanks (again), now I understand why I had two entries in the databases liste... Anyway do you planned to port the interface to ExtJS 4 ? -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Plugin::AutoCRUD 2.x and ExtJS 4
2011/10/10 Oliver Gorwits oli...@cpan.org: On 10/10/2011 16:37, jul@gmail.com wrote: Anyway do you plan to port the interface to ExtJS 4 ? Maybe, but no definite plans. Here are a few thoughts I have right now... 1) the current interface works quite well I agree. 2) but there's too much logic in the templates so they need rewriting Code always need to be rewriting.. 3) the license terms of ExtJS (2.x and 4.x) are evil (GPLv3) Don't want to launch a flamewar. 4) is there another, similar, toolkit with a better license? I don't know, but I am afraid no. 5) but not JQuery + 1001 plugins - I think this is messy I agree again. 6) I'm not a UI person so it's a lot of effort for me to do I can help. ExtJS 4 doesn't seem to offer much that would improve the interface, other than perhaps the paging-less infinite scroll grid. Filters also can be integrated in column's headers (available also in 2.2) Anyway ExtJS 4 offers a cleaner abstraction of models, views and controller used inside the interface, so the mapping between the Catalyst components and ExtJS can probably be improved. As the frontend's API (the AJAX/JSON bit) isn't documented, I don't expect to have anyone cough up a new interface. But if any mock-ups with other JS toolkits are forthcoming then there's a good chance I'll try to graft it on if the features (filtering, etc) are equivalent. I wil try a simple test with ExtJS 4, and post it soo. regards, -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Double encoding of UTF8 strings
Hi, I have installed and ran successfully the AutoCRUD plugin, I set up a mysql database tables to use UT8 charset, the charset in the ajax requests is utf-8, everything seems correct, except the data in the grids are double encoded, that means é instead of é. I am pretty sure that the data in the database are correct, and the json data are also correctly displayed (the raw data received contains the wrong characters). The double encoding seems then to appear in the View of AutoCRUD, that is just a Catalyst::JSON::View simply used without any customization. I have hacked around this AutoCRUD JSON view, and end up with a solution : - overload the encode_json method in the view to call directly JSON::XS without the utf8 call, ie a simple JSON::XS-new-encode($data); - and overload the process method in order to remove the $json = Encode::encode($encoding, $json); In short : don't touch my data, they are already in utf8, just send them to the browser. It works, but I don't know why... It is probably a bad solution, as I can't imagine that Catalyst::JSON::View is wrong, but I wonder what is the correct way to do it. Couldn't it be a problem in DBIx::Class that does not correctly handle ut8 columns ? -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Plugin::AutoCRUD example not working?
2011/10/7 Oliver Gorwits oli...@cpan.org: AutoCRUD is definitely maintained, and generally works very well. 'No sources defined' sounds to me like possibly your AutoCRUD config is wrong... I can't read the demo from here though, so can't help with specific advice, sorry. I released a new beta of AutoCRUD a couple of days ago, but it seems metacpan.org doesn't scream DEVELOPMENT RELEASE at the user in the same way search.cpan.org does - so I'm sorry if some users innocently downloaded the 2.x TRIAL version, instead of the 1.x stable release. The OP is probably quite right - AutoCRUD's demo app mightn't work, as I've focused on getting the 1.x test suite to pass under 2.x (which it does :-). AutoCRUD is developed on the shifting sands of many other modules, and it may also be that changes elsewhere need to be handled. If anyone wants to try the 2.x release of AutoCRUD - please do! In order to ease the solving of my utf-8 bug I have developed a poc ; you can download it at http://gilles.tk/TestUTF8-0.01.tar.gz It's a simple Catalyst App, with a sqlite3 database with only one table and a text column, with utf-8 content. I tried to run it with the 2.x Trial (same code, same config, only changing the AutoCRUD modules), and I have the following error : Caught exception in TestUTF8::Controller::AutoCRUD::Root-err_message Use of uninitialized value in exists at /usr/local/share/perl/5.10.1/Catalyst/Plugin/AutoCRUD/Controller/Root.pm line 158. -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Double encoding of UTF8 strings
As I sayed in one another thread, I have developped a simple Catalyst application to test this utf-8 bug. You can download it at http://gilles.tk/TestUTF8-0.01.tar.gz Only simple catalyst.pl calls, a simple sqlite3 database, using default debian environnement. I have added a line in the sqlite database with éè, and you can see the result... Thanks for testing to confirm (or not) if you have the same behaviour. -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Re: Pb with fcgid on CentOS
On Tue, Sep 21, 2010 at 16:23, jul@gmail.com jul@gmail.com wrote: Hi, I have a trouble to run Catalyst with Apache2/fcgid/suexec on CentOS 5.5 I have a classical VirtualHost definition in the apache configuration with : DocumentRoot /opt/myapp/root Alias /static /opt/myapp/root/static SuexecUserGroup appuser appuser Location /static SetHandler default-handler /Location Alias / /var/www/myapp/myapp_wrapper.fpl/ Location / Options ExecCGI Order allow,deny Allow from all /Location The myapp_wrapper.fpl contains mainly : unshift @ARGV, /opt/myapp/script/myapp_fastcgi.pl; exec @ARGV or die... to run the fastcgi command of Catalyst keeping the arguments. (The fpl script must be in /var/www because of suexec configuration). The wrapper script is called, the fastcgi.pl script also, but ends up with : STDIN is not a socket; specify a listen location at .../Catalyst/Engine/FastCGI.pm line 95. It seems to me, according fcgid documentation, that a socket is created, but it is not send to the myapp_fastcgi.pl A Dumper(\...@argv) and Dumper(\%ENV) in the wrapper reveals that no arguments are send to the script, and that the environment variables only contains PATH, so error message is correct... Suggestions welcome... I have found the problem : SELinux was activated by default, and the fcgi wrapper was running with limited permissions. It is probably possible to tune SELinux to allow the scripts to access ressources, but deactivate it solves the problems. -- Julien. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Pb with fcgid on CentOS
Hi, I have a trouble to run Catalyst with Apache2/fcgid/suexec on CentOS 5.5 I have a classical VirtualHost definition in the apache configuration with : DocumentRoot /opt/myapp/root Alias /static /opt/myapp/root/static SuexecUserGroup appuser appuser Location /static SetHandler default-handler /Location Alias / /var/www/myapp/myapp_wrapper.fpl/ Location / Options ExecCGI Order allow,deny Allow from all /Location The myapp_wrapper.fpl contains mainly : unshift @ARGV, /opt/myapp/script/myapp_fastcgi.pl; exec @ARGV or die... to run the fastcgi command of Catalyst keeping the arguments. (The fpl script must be in /var/www because of suexec configuration). The wrapper script is called, the fastcgi.pl script also, but ends up with : STDIN is not a socket; specify a listen location at .../Catalyst/Engine/FastCGI.pm line 95. It seems to me, according fcgid documentation, that a socket is created, but it is not send to the myapp_fastcgi.pl A Dumper(\...@argv) and Dumper(\%ENV) in the wrapper reveals that no arguments are send to the script, and that the environment variables only contains PATH, so error message is correct... Suggestions welcome... -- Julien Gilles. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/