]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Checkin fix for Bug 280633, which didn't work when the utf8 parameter was turned on.
authormkanat%bugzilla.org <>
Sat, 18 Nov 2006 23:54:59 +0000 (23:54 +0000)
committermkanat%bugzilla.org <>
Sat, 18 Nov 2006 23:54:59 +0000 (23:54 +0000)
Bugzilla.pm
contrib/recode.pl

index 5a9d23e14daac857119683c776b0bc6fe92cffeb..7c52dd50028369d800b4db005aaf7d7818079caa 100644 (file)
@@ -53,6 +53,7 @@ our $_request_cache = {};
 use constant SHUTDOWNHTML_EXEMPT => [
     'editparams.cgi',
     'checksetup.pl',
+    'recode.pl',
 ];
 
 # Non-cgi scripts that should silently exit.
index 7db01dddfdedec93515a294b3f9a9ea60f6de21c..10a4cbb44b539f9791bd1eaaeff8fb647c953354 100755 (executable)
@@ -174,9 +174,17 @@ if (exists $switch{'overrides'}) {
 
 my $dbh = Bugzilla->dbh;
 
-# Make the database give us raw bytes.
-$dbh->do('SET character_set_results = NULL')
-    if $dbh->isa('Bugzilla::DB::Mysql');
+if ($dbh->isa('Bugzilla::DB::Mysql')) {
+    # Get the actual current encoding of the DB.
+    my $collation_data = $dbh->selectrow_arrayref(
+        "SHOW VARIABLES LIKE 'character_set_database'");
+    my $db_charset = $collation_data->[1];
+    # Set our connection encoding to *that* encoding, so that MySQL
+    # correctly accepts our changes.
+    $dbh->do("SET NAMES $db_charset");
+    # Make the database give us raw bytes.
+    $dbh->do('SET character_set_results = NULL')
+}
 
 $dbh->begin_work;