Bug 9010 - Follou up Quote of the day: Umlauts do not display correctly
authorMarc Veron <veron@veron.ch>
Tue, 6 Nov 2012 12:56:30 +0000 (13:56 +0100)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 10 Nov 2012 01:02:11 +0000 (20:02 -0500)
After applying Serhij's patch I had still troubles with umlauts, e.g. while editing or adding a new quote.

Added explicit utf-8 encoding at 3 places.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Passed-QA-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
tools/quotes/quotes_ajax.pl

index 528c3dd..da5dc01 100755 (executable)
@@ -58,10 +58,11 @@ if ($params->{'action'} eq 'add') {
     my $new_quote_id = $dbh->{q{mysql_insertid}}; # ALERT: mysqlism here
     $sth = $dbh->prepare('SELECT * FROM quotes WHERE id = ?;');
     $sth->execute($new_quote_id);
-    print to_json($sth->fetchall_arrayref);
+    print to_json($sth->fetchall_arrayref, {utf8 =>1});
     exit 1;
 }
 elsif ($params->{'action'} eq 'edit') {
+    my $aaData = [];
     my $editable_columns = [qw(source text)]; # pay attention to element order; these columns match the quotes table columns
     my $sth = $dbh->prepare("UPDATE quotes SET $editable_columns->[$params->{'column'}-1]  = ? WHERE id = ?;");
     $sth->execute($params->{'value'}, $params->{'id'});
@@ -71,7 +72,9 @@ elsif ($params->{'action'} eq 'edit') {
     }
     $sth = $dbh->prepare("SELECT $editable_columns->[$params->{'column'}-1] FROM quotes WHERE id = ?;");
     $sth->execute($params->{'id'});
-    print $sth->fetchrow_array();
+    $aaData = $sth->fetchrow_array();
+    print Encode::encode('utf8', $aaData);
+
     exit 1;
 }
 elsif ($params->{'action'} eq 'delete') {
@@ -106,5 +109,5 @@ else {
                     iTotalDisplayRecords=>  $iTotalDisplayRecords,
                     sEcho               =>  $params->{'sEcho'},
                     aaData              =>  $aaData,
-                  });
+                  }, {utf8 =>1});
 }