commented out barcode lengths by library because it takes up a lot of space and isn...
[migration-tools.git] / dump_oracle_table_for_pg
index b226bc2..2b18484 100755 (executable)
@@ -25,6 +25,7 @@ use Carp;
 use DBI;
 use Getopt::Long;
 use Encode;
+use MARC::Charset qw/marc8_to_utf8/;
 
 my $host = 'localhost';
 my $sid = $ENV{ORACLE_SID};
@@ -81,6 +82,7 @@ export_table(uc $table, $outfh, $sqlfh, $out);
 
 close $outfh;
 close $sqlfh;
+$dbh->disconnect;
 
 exit 0;
 
@@ -124,7 +126,11 @@ sub normalize_value_for_tsv {
         $val =~ s/\t/\\t/g;
         $val =~ s/\v/\\v/g;
         if ($src_charset) {
-            return decode($src_charset, $val);
+            if ($src_charset eq 'marc8') {
+                return marc8_to_utf8($val);
+            } else {
+                return decode($src_charset, $val);
+            }
         } else {
             return $val;
         }