use DBI;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(path_translated);
+use Encode qw/decode/;
+
+# Connect to DB
+my $connect = "DBI:Pg:dbname=new";
+my $user = "web";
+my $passwd = "";
my $debug = 1;
$workbook = Spreadsheet::WriteExcel->new("sql_result.xls");
}
-# Connect to DB
-my $connect = "DBI:Pg:dbname=new";
-my $user = "web";
-my $passwd = "";
-
my $dbh = DBI->connect($connect,$user,$passwd) || die $DBI::errstr;
+sub _c {
+ return decode('iso-8859-2', shift);
+}
+
foreach my $sql_file (@sql_files) {
my $sheet_name = $sql_file;
my $fmt_comment = $workbook->addformat(); # Add a format
$fmt_comment->set_bold();
- $worksheet->write($row, 0, $comment, $fmt_comment);
+ $worksheet->write($row, 0, _c($comment), $fmt_comment);
$row+=2;
}
while (my @row = $sth->fetchrow_array() ) {
for(my $col=0; $col<=$#row; $col++) {
- $worksheet->write($row, $col, $row[$col] );
+ $worksheet->write($row, $col, _c( $row[$col] ) );
}
$row++;
}