From 0d88b1e6d229c373a3b06adf3d6b8d7d9e278975 Mon Sep 17 00:00:00 2001 From: Gerhard Gonter <ggonter@gmail.com> Date: Mon, 2 Oct 2017 17:39:28 +0200 Subject: [PATCH] add option to turn utf8 mode on --- lib/Redmine/DB/MySQL.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Redmine/DB/MySQL.pm b/lib/Redmine/DB/MySQL.pm index 935b676..02ab8fa 100644 --- a/lib/Redmine/DB/MySQL.pm +++ b/lib/Redmine/DB/MySQL.pm @@ -29,8 +29,20 @@ sub connect my $db_con= join (':', 'dbi', $adapter, map { $self->{$_} } qw(database host)); # print "db_con=[$db_con]\n"; + $dbh= DBI->connect($db_con, map { $self->{$_} } qw(username password)); # print "dbh=[$dbh]\n"; + + if (exists ($self->{encoding})) + { + if ($self->{encoding} eq 'utf8') + { + # print __FILE__, ' ', __LINE__, " NOTE: turning on utf8 mode in MySQL driver\n"; + $dbh->{mysql_enable_utf8}= 1; + $dbh->do('set names utf8'); + } + } + $self->{'_dbh'}= $dbh; } -- GitLab