[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1123] branches/1.2



Revision: 1123
          http://svn.sourceforge.net/ledger-smb/?rev=1123&view=rev
Author:   tetragon
Date:     2007-05-03 22:13:09 -0700 (Thu, 03 May 2007)

Log Message:
-----------
UTF-8 update backpatch

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Form.pm
    branches/1.2/LedgerSMB/Locale.pm
    branches/1.2/LedgerSMB/Sysconfig.pm
    branches/1.2/LedgerSMB/User.pm
    branches/1.2/import_members.pl
    branches/1.2/net-setup.pl
    branches/1.2/utils/notify_short/listener.pl

Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/LedgerSMB/Form.pm	2007-05-04 05:13:09 UTC (rev 1123)
@@ -41,6 +41,9 @@
 use Cwd;
 use File::Copy;
 
+use charnames ':full';
+use open ':utf8';
+
 package Form;
 
 sub new {
@@ -98,7 +101,7 @@
         $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 @@
         $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 @@
     $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 @@
     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 @@
         $myconfig->{dbconnect}, $myconfig->{dbuser},
         $myconfig->{dbpasswd}, { AutoCommit => 0 }
     ) or $self->dberror;
+    $dbh->{pg_enable_utf8} = 1;
 
     # set db options
     if ( $myconfig->{dboptions} ) {

Modified: branches/1.2/LedgerSMB/Locale.pm
===================================================================
--- branches/1.2/LedgerSMB/Locale.pm	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/LedgerSMB/Locale.pm	2007-05-04 05:13:09 UTC (rev 1123)
@@ -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 @@
 
 sub text {
     my ( $self, $text, @params ) = @_;
-    return encode_entities( $self->maketext( $text, @params ) );
+    return $self->maketext( $text, @params );
 }
 
 ##sub date {

Modified: branches/1.2/LedgerSMB/Sysconfig.pm
===================================================================
--- branches/1.2/LedgerSMB/Sysconfig.pm	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/LedgerSMB/Sysconfig.pm	2007-05-04 05:13:09 UTC (rev 1123)
@@ -123,6 +123,7 @@
         $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

Modified: branches/1.2/LedgerSMB/User.pm
===================================================================
--- branches/1.2/LedgerSMB/User.pm	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/LedgerSMB/User.pm	2007-05-04 05:13:09 UTC (rev 1123)
@@ -196,6 +196,7 @@
           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 @@
     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 @@
     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 @@
                   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 @@
           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 @@
     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 @@
     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 @@
               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 @@
             $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 @@
             $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 @@
         $form->{dbconnect}, $form->{dbuser},
         $form->{dbpasswd}, { AutoCommit => 0 }
     ) or $form->dberror( __FILE__ . ':' . __LINE__ );
+    $dbh->{pg_enable_utf8} = 1;
 
     my $login = $form->{login};
     $login =~ s/@.*//;

Modified: branches/1.2/import_members.pl
===================================================================
--- branches/1.2/import_members.pl	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/import_members.pl	2007-05-04 05:13:09 UTC (rev 1123)
@@ -234,6 +234,7 @@
             $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};

Modified: branches/1.2/net-setup.pl
===================================================================
--- branches/1.2/net-setup.pl	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/net-setup.pl	2007-05-04 05:13:09 UTC (rev 1123)
@@ -779,6 +779,7 @@
                 die "You have postgres version $version installed, "
                   . "we require a minimum of 8.0\n";
             }
+            $dbh->{pg_enable_utf8} = 1;
         };
         if ($@) {
             system("tput clear");

Modified: branches/1.2/utils/notify_short/listener.pl
===================================================================
--- branches/1.2/utils/notify_short/listener.pl	2007-04-30 02:06:42 UTC (rev 1122)
+++ branches/1.2/utils/notify_short/listener.pl	2007-05-04 05:13:09 UTC (rev 1123)
@@ -23,6 +23,7 @@
         RaiseError => 1,
     }
 );
+$dbh->{pg_enable_utf8} = 1;
 
 my $sth;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.