summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/Form.pm10
-rw-r--r--LedgerSMB/Locale.pm3
-rw-r--r--LedgerSMB/Sysconfig.pm1
-rwxr-xr-xLedgerSMB/User.pm12
-rwxr-xr-ximport_members.pl1
-rwxr-xr-xnet-setup.pl1
-rw-r--r--utils/notify_short/listener.pl1
7 files changed, 26 insertions, 3 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index a53668b1..011f2666 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -41,6 +41,9 @@ use Time::Local;
use Cwd;
use File::Copy;
+use charnames ':full';
+use open ':utf8';
+
package Form;
sub new {
@@ -98,7 +101,7 @@ sub new {
$self->error( "Access Denied", __line__, __file__ );
}
- for ( keys %$self ) { $self->{$_} =~ s/\000//g }
+ for ( keys %$self ) { $self->{$_} =~ s/\N{NULL}//g }
$self;
}
@@ -138,6 +141,7 @@ sub escape {
$str = $self->escape( $str, 1 ) if $1 == 0 && $2 < 44;
}
+ utf8::encode($str);
$str =~ s/([^a-zA-Z0-9_.-])/sprintf("%%%02x", ord($1))/ge;
$str;
@@ -149,7 +153,9 @@ sub unescape {
$str =~ tr/+/ /;
$str =~ s/\\$//;
+ utf8::encode($str) if utf8::is_utf8($str);
$str =~ s/%([0-9a-fA-Z]{2})/pack("c",hex($1))/eg;
+ utf8::decode($str);
$str =~ s/\r?\n/\n/g;
$str;
@@ -1582,6 +1588,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} ) {
@@ -1601,6 +1608,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/Locale.pm b/LedgerSMB/Locale.pm
index c89fbef0..6b1c4e66 100644
--- a/LedgerSMB/Locale.pm
+++ b/LedgerSMB/Locale.pm
@@ -27,7 +27,6 @@
package LedgerSMB::Locale;
use base 'Locale::Maketext';
use Locale::Maketext::Lexicon;
-use HTML::Entities;
use Encode;
Locale::Maketext::Lexicon->import(
@@ -40,7 +39,7 @@ Locale::Maketext::Lexicon->import(
sub text {
my ( $self, $text, @params ) = @_;
- return encode_entities( $self->maketext( $text, @params ) );
+ return $self->maketext( $text, @params );
}
##sub date {
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index c1924916..6a78f3ac 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -123,6 +123,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 a46a530a..7ef25547 100755
--- 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_enable_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
@@ -474,6 +481,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/ ) {
@@ -496,6 +504,7 @@ sub dbneedsupdate {
DBI->connect( $form->{dbconnect}, $form->{dbuser},
$form->{dbpasswd} )
or $form->dberror( __FILE__ . ':' . __LINE__ );
+ $dbh->{pg_enable_utf8} = 1;
$query = qq|
SELECT tablename
@@ -561,6 +570,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|
@@ -790,6 +800,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};
@@ -843,6 +854,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/net-setup.pl b/net-setup.pl
index a9fc3341..ca2c16ac 100755
--- a/net-setup.pl
+++ b/net-setup.pl
@@ -779,6 +779,7 @@ sub check_pgconnect {
die "You have postgres version $version installed, "
. "we require a minimum of 8.0\n";
}
+ $dbh->{pg_enable_utf8} = 1;
};
if ($@) {
system("tput clear");
diff --git a/utils/notify_short/listener.pl b/utils/notify_short/listener.pl
index 05b5afd0..5662cdb5 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;