Quicksearch, mod_perl, postgresql, and UTF-8

Fredrik Jonson fredrik at jonson.org
Wed Nov 2 16:31:03 UTC 2011


Hi all,

I've resently upgraded from cgi to mod_perl on a bz 4.0.2 installation that use
postgresql and UTF-8. I soon found that the quicksearch doesn't work when you
submit non-ascii characters, like åäö. You get a internal server error and the
log states: "ERROR:  invalid byte sequence for encoding "UTF8": 0xe5e4f6"

I believe that you a similar issue on landfill with the query below:

https://landfill.bugzilla.org/bugzilla-tip-pg/buglist.cgi?quicksearch=%E5%E4%F6

The patch below fixes that error on my local installation. Haven't tested it
beyond that. I'd be happy to open a issue if it is of general interest.

RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm,v
retrieving revision 1.35.2.7
diff -u -r1.35.2.7 Quicksearch.pm
--- Bugzilla/Search/Quicksearch.pm	27 Jan 2011 13:03:39 -0000	1.35.2.7
+++ Bugzilla/Search/Quicksearch.pm	2 Nov 2011 16:08:32 -0000
@@ -30,6 +30,8 @@
 use Bugzilla::Field;
 use Bugzilla::Util;

+use Encode::Encoder;
+
 use List::Util qw(min max);
 use List::MoreUtils qw(firstidx);

@@ -138,6 +140,8 @@
     $and   = 0;
     $or    = 0;

+    $searchstring = Encode::encode('UTF-8', $searchstring);
+
     # Remove leading and trailing commas and whitespace.
     $searchstring =~ s/(^[\s,]+|[\s,]+$)//g;
     ThrowUserError('buglist_parameters_required') unless ($searchstring);

--
Fredrik Jonson
_______________________________________________
dev-apps-bugzilla mailing list
dev-apps-bugzilla at lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-apps-bugzilla


More information about the developers mailing list