Browse Source

utf8 for mysql

master
Pascal Gloor 5 years ago
parent
commit
cb04c4c7ee
2 changed files with 4 additions and 2 deletions
  1. 2
    1
      bin/autodoc_process.pl
  2. 2
    1
      cgi/autodoc.fcgi

+ 2
- 1
bin/autodoc_process.pl View File

use strict; use strict;
use JSON; use JSON;
use DBI; use DBI;
use utf8;
use GD::Simple; use GD::Simple;
use Data::Dumper; use Data::Dumper;
use Data::UUID; use Data::UUID;
my($sql) = @_; my($sql) = @_;


my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}"; my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}";
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}) || \\
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}, { mysql_enable_utf8 => 1 }) || \
die "Failed to connect to database"; die "Failed to connect to database";


return $dbh; return $dbh;

+ 2
- 1
cgi/autodoc.fcgi View File

use FCGI; use FCGI;
use JSON; use JSON;
use DBI; use DBI;
use utf8;
use GD::Simple; use GD::Simple;
use Data::Dumper; use Data::Dumper;
use Data::UUID; use Data::UUID;
my($sql) = @_; my($sql) = @_;


my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}"; my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}";
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}) || \\
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}, { mysql_enable_utf8 => 1 }) || \
fatal_api_error(500,"Failed to connect to database"); fatal_api_error(500,"Failed to connect to database");


return $dbh; return $dbh;

Loading…
Cancel
Save