summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-11-23 13:58:33 +0100
committermkanat%bugzilla.org <>2007-11-23 13:58:33 +0100
commit9f0310bf8c0821347699b434f659eb52decabf87 (patch)
tree31153ecb72f2b57a9bb3daf638cc4e1152f8a0b0 /Bugzilla/DB
parent8ab75a83c21606ad77a38c05057f886011fa0451 (diff)
downloadbugzilla-9f0310bf8c0821347699b434f659eb52decabf87.tar.gz
bugzilla-9f0310bf8c0821347699b434f659eb52decabf87.tar.xz
Bug 363153: Turn on the utf8 bit on all strings in Bugzilla that contain
non-ASCII data, if the utf8 parameter is on. This means that string functions like substr() work properly on multi-byte languages, now. Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=wurblzap, a=mkanat
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Mysql.pm4
-rw-r--r--Bugzilla/DB/Pg.pm4
2 files changed, 6 insertions, 2 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index 25ee32b64..9e0d25277 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -58,8 +58,10 @@ sub new {
my $dsn = "DBI:mysql:host=$host;database=$dbname";
$dsn .= ";port=$port" if $port;
$dsn .= ";mysql_socket=$sock" if $sock;
+
+ my $attrs = { mysql_enable_utf8 => Bugzilla->params->{'utf8'} };
- my $self = $class->db_new($dsn, $user, $pass);
+ my $self = $class->db_new($dsn, $user, $pass, $attrs);
# This makes sure that if the tables are encoded as UTF-8, we
# return their data correctly.
diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm
index 9f5b67757..bd16b654c 100644
--- a/Bugzilla/DB/Pg.pm
+++ b/Bugzilla/DB/Pg.pm
@@ -68,7 +68,9 @@ sub new {
# creating tables.
$dsn .= ";options='-c client_min_messages=warning'";
- my $self = $class->db_new($dsn, $user, $pass);
+ my $attrs = { pg_enable_utf8 => Bugzilla->params->{'utf8'} };
+
+ my $self = $class->db_new($dsn, $user, $pass, $attrs);
# all class local variables stored in DBI derived class needs to have
# a prefix 'private_'. See DBI documentation.