From bd398c9423814315b3fc7a99ffa5f3e16a1df5ea Mon Sep 17 00:00:00 2001 From: josch Date: Fri, 12 Oct 2007 10:37:02 +0000 Subject: [PATCH] unicode searches git-svn-id: http://yolanda.mister-muffin.de/svn@51 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/include.pl | 1 + trunk/search.pl | 6 ++---- trunk/xsl/xhtml.xsl | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/trunk/include.pl b/trunk/include.pl index e80ee3f..548bdbe 100644 --- a/trunk/include.pl +++ b/trunk/include.pl @@ -5,6 +5,7 @@ use CGI::Session; use DBI; use XML::Simple qw(:strict); use Digest::SHA; +use Encode; $gnutube_root = '/var/www/gnutube'; diff --git a/trunk/search.pl b/trunk/search.pl index eb2439a..a5e0bef 100644 --- a/trunk/search.pl +++ b/trunk/search.pl @@ -9,14 +9,12 @@ $session = new CGI::Session; #check if query is set if($query->param('query')) { - my $search_query = $query->param('query'); - $page = XMLin("$gnutube_root/search.xml", ForceArray => 1, KeyAttr => {} ); #if a username is associated with session id, username is nonempty $page->{username} = get_username_from_sid($session->id); - $page->{results}->{query} = $query->param('query'); + $page->{results}->{query} = decode_utf8($query->param('query')); #connect to db my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; @@ -25,7 +23,7 @@ if($query->param('query')) my $sth = $dbh->prepare(qq{select title, caption, timestamp from videos where match(title, caption) against( ? ) }) or die $dbh->errstr; #execute it - $sth->execute($search_query) or die $dbh->errstr; + $sth->execute($query->param('query')) or die $dbh->errstr; #get every returned value while (my ($title, $caption, $timestamp) = $sth->fetchrow_array()) diff --git a/trunk/xsl/xhtml.xsl b/trunk/xsl/xhtml.xsl index 00aa85d..7bff3f6 100755 --- a/trunk/xsl/xhtml.xsl +++ b/trunk/xsl/xhtml.xsl @@ -10,7 +10,7 @@