X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=sync.pl;h=113df7d93ba04ae3b0cc07ce0696016c8e145bab;hb=fde909c294de9806dd6337f5acb0ed87c41557c6;hp=9af864217b9712c67e7fc8536779e87e69c2aa15;hpb=c50bd339f0e959dc796f9a3dea2e08941ef504a5;p=wloh diff --git a/sync.pl b/sync.pl index 9af8642..113df7d 100755 --- a/sync.pl +++ b/sync.pl @@ -13,11 +13,7 @@ sub copy_escape { if (!defined($x)) { return '\N'; } - $x = Encode::decode('iso8859-1', $x); - $x =~ s/\\/\\\\/g; - $x =~ s/\r/\\r/g; - $x =~ s/\n/\\n/g; - $x =~ s/\t/\\t/g; + $x =~ s/([\\\r\n\t])/\\$1/g; return $x; } @@ -49,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");