summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB.pm1
-rw-r--r--LedgerSMB/Form.pm2
-rw-r--r--LedgerSMB/RESTXML/Handler.pm1
-rw-r--r--LedgerSMB/Sysconfig.pm1
-rw-r--r--LedgerSMB/User.pm13
-rwxr-xr-ximport_members.pl1
-rw-r--r--utils/notify_short/listener.pl1
7 files changed, 20 insertions, 0 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 5727edbe..073a73ab 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -490,6 +490,7 @@ sub db_init {
) or $self->dberror;
$dbh->{pg_server_prepare} = 0;
+ $dbh->{pg_enable_utf8} = 1;
if ( $myconfig->{dboptions} ) {
$dbh->do( $myconfig->{dboptions} );
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index e789ed57..ef997711 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -1581,6 +1581,7 @@ sub dbconnect {
my $dbh = DBI->connect( $myconfig->{dbconnect},
$myconfig->{dbuser}, $myconfig->{dbpasswd} )
or $self->dberror;
+ $dbh->{pg_enable_utf8} = 1;
# set db options
if ( $myconfig->{dboptions} ) {
@@ -1600,6 +1601,7 @@ sub dbconnect_noauto {
$myconfig->{dbconnect}, $myconfig->{dbuser},
$myconfig->{dbpasswd}, { AutoCommit => 0 }
) or $self->dberror;
+ $dbh->{pg_enable_utf8} = 1;
# set db options
if ( $myconfig->{dboptions} ) {
diff --git a/LedgerSMB/RESTXML/Handler.pm b/LedgerSMB/RESTXML/Handler.pm
index 0939da7f..ab63ad2a 100644
--- a/LedgerSMB/RESTXML/Handler.pm
+++ b/LedgerSMB/RESTXML/Handler.pm
@@ -124,6 +124,7 @@ sub connect_db {
my $dbh = DBI->connect( $myconfig->{dbconnect},
$myconfig->{dbuser}, $myconfig->{dbpasswd} )
or carp "Error connecting to the db :$DBI::errstr";
+ $dbh->{pg_enable_utf8} = 1;
return $dbh;
}
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index e2b8c09d..e01618cc 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -125,6 +125,7 @@ if ( $config{globaldb}{DBname} ) {
$form = new Form;
$form->error("No GlobalDBH Configured or Could not Connect");
}
+ $GLOBALDBH->{pg_enable_utf8} = 1;
}
# These lines prevent other apps in mod_perl from seeing the global db
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index c24eb98f..e9600deb 100644
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -196,6 +196,7 @@ sub login {
DBI->connect( $myconfig{dbconnect}, $myconfig{dbuser},
$myconfig{dbpasswd} )
or $self->error( __FILE__ . ':' . __LINE__ . ': ' . $DBI::errstr );
+ $dbh->{pg_enable_utf8} = 1;
# we got a connection, check the version
my $query = qq|
@@ -263,6 +264,7 @@ sub check_recurring {
my $dbh =
DBI->connect( $self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_encode_utf8} = 1;
my $query = qq|
SELECT count(*) FROM recurring
@@ -319,6 +321,7 @@ sub dbsources {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
if ( $form->{dbdriver} eq 'Pg' ) {
@@ -337,6 +340,7 @@ sub dbsources {
DBI->connect( $form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
$query = qq|
SELECT tablename FROM pg_tables
@@ -380,6 +384,7 @@ sub dbcreate {
DBI->connect( $form->{dbconnect}, $form->{dbsuperuser},
$form->{dbsuperpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $superdbh->{pg_enable_utf8} = 1;
my $query = qq|$dbcreate{$form->{dbdriver}}|;
$superdbh->do($query)
|| $form->dberror( __FILE__ . ':' . __LINE__ . $query );
@@ -394,11 +399,13 @@ sub dbcreate {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
if ( $form->{dbsuperuser} ) {
my $superdbh =
DBI->connect( $form->{dbconnect}, $form->{dbsuperuser},
$form->{dbsuperpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $superdbh->{pg_enable_utf8} = 1;
# JD: We need to check for plpgsql,
# if it isn't there create it, if we can't error
@@ -470,6 +477,7 @@ sub dbdelete {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
my $query = qq|DROP DATABASE "$form->{db}"|;
$dbh->do($query) || $form->dberror( __FILE__ . ':' . __LINE__ . $query );
@@ -526,6 +534,7 @@ sub dbneedsupdate {
my $dbh =
DBI->connect( $form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
if ( $form->{dbdriver} =~ /Pg/ ) {
@@ -548,6 +557,7 @@ sub dbneedsupdate {
DBI->connect( $form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8};
$query = qq|
SELECT tablename
@@ -613,6 +623,7 @@ sub dbupdate {
$form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd}, { AutoCommit => 0 }
) or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
# check version
$query = qq|
@@ -842,6 +853,7 @@ sub save_member {
$self->{dbconnect}, $self->{dbuser},
$self->{dbpasswd}, { AutoCommit => 0 }
) or $self->error($DBI::errstr);
+ $dbh->{pg_enable_utf8} = 1;
# add login to employees table if it does not exist
my $login = $self->{login};
@@ -895,6 +907,7 @@ sub delete_login {
$form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd}, { AutoCommit => 0 }
) or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
my $login = $form->{login};
$login =~ s/@.*//;
diff --git a/import_members.pl b/import_members.pl
index ba135d25..4ffe765a 100755
--- a/import_members.pl
+++ b/import_members.pl
@@ -234,6 +234,7 @@ sub save_member {
$self->{dbconnect}, $self->{dbuser},
$self->{dbpasswd}, { AutoCommit => 0 }
) or $self->error($DBI::errstr);
+ $dbh->{pg_enable_utf8} = 1;
# add login to employee table if it does not exist
my $login = $self->{login};
diff --git a/utils/notify_short/listener.pl b/utils/notify_short/listener.pl
index acbb7c91..d876b497 100644
--- a/utils/notify_short/listener.pl
+++ b/utils/notify_short/listener.pl
@@ -23,6 +23,7 @@ my $dbh = DBI->connect(
RaiseError => 1,
}
);
+$dbh->{pg_enable_utf8} = 1;
my $sth;