[Koha-patches] [PATCH] Bug 13815 - plack loose CGI qw(-utf8) flag creating incorrect utf-8 encoding everywhere
Dobrica Pavlinusic
dpavlin at rot13.org
Tue Mar 17 12:15:48 CET 2015
This is major problem for plack installations with utf-8 encoding.
In this case, we are overriding CGI->new to setup utf-8 flag and
get correctly decoded $cgi->params, and reset syspref cache using
C4::Context->clear_syspref_cache
Test scenario:
1. under plack try to search with utf-8 charactes
2. try to find patron with utf-8 characters
---
misc/plack/koha.psgi | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/misc/plack/koha.psgi b/misc/plack/koha.psgi
index 7acb567..a35eb77 100644
--- a/misc/plack/koha.psgi
+++ b/misc/plack/koha.psgi
@@ -5,6 +5,18 @@ use lib qw( ./lib );
use Plack::Middleware::Debug;
use Plack::App::Directory;
+use CGI qw(-utf8 ); # we will loose -utf8 under plack
+{
+ no warnings 'redefine';
+ my $old_new = \&CGI::new;
+ *CGI::new = sub {
+ my $q = $old_new->( @_ );
+ $CGI::PARAM_UTF8 = 1;
+ C4::Context->clear_syspref_cache();
+ return $q;
+ };
+}
+
BEGIN {
# override configuration from startup script below:
--
1.7.2.5
More information about the Koha-patches
mailing list