diff --git a/lib/Redmine/DB/MySQL.pm b/lib/Redmine/DB/MySQL.pm index 935b6769509676094bfd56da5ab69c03e2ae2c3d..02ab8fadddf2671e35927ae8356131490e9e71a4 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; }