]> git.sesse.net Git - wloh/commitdiff
Instead of translating back and forth between iso8859-1 and utf-8, tell the server...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 25 Aug 2012 11:18:08 +0000 (13:18 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 25 Aug 2012 11:18:08 +0000 (13:18 +0200)
sync.pl

diff --git a/sync.pl b/sync.pl
index c57325965d93c9e4acf381bc057aff128f7ecbe9..113df7d93ba04ae3b0cc07ce0696016c8e145bab 100755 (executable)
--- a/sync.pl
+++ b/sync.pl
@@ -13,7 +13,6 @@ sub copy_escape {
        if (!defined($x)) {
                return '\N';
        }
-       $x = Encode::decode('iso8859-1', $x);
        $x =~ s/([\\\r\n\t])/\\$1/g;
        return $x;
 }
@@ -46,6 +45,7 @@ my $sdbh = DBI->connect($config::local_connstr, $config::local_username, $config
        or die "PostgreSQL connect: " . $DBI::errstr;
 $sdbh->{AutoCommit} = 0;
 $sdbh->{RaiseError} = 1;
+$sdbh->do("SET client_encoding TO 'iso8859-1';");
 
 # For our own enjoyment.
 sync_table($mdbh, $sdbh, "Fotballbrukere");