From: Nicolas Boisselier Date: Tue, 18 Nov 2025 07:53:12 +0000 (+0100) Subject: bin/csv2human X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=a25aaa8cabebe7c1efc89f2ce4b4727da9cf6dcf;p=nb.git bin/csv2human --- diff --git a/bin/csv2human b/bin/csv2human index 28424296..a7471db4 100755 --- a/bin/csv2human +++ b/bin/csv2human @@ -41,9 +41,6 @@ $main::_DATA_ = undef; ################################################################################# #use Data::Dumper; print Dumper(\%Opt); use Encode; -binmode( STDOUT, "raw:" ); -# NB 13.12.23 binmode( STDOUT, "utf8:" ); - # # Calculate lengths @@ -54,16 +51,11 @@ my @lines = (); use Encode; my $ENCODE = 1; binmode STDOUT, ":utf8" if $ENCODE; +#binmode STDOUT, "raw:"; #binmode STDOUT; sub realLength() { - #return scalar( map $_, $_[0] =~ /(.)/gs ); - #my $l = length($_[0]); - #my $l = bytes::length($_[0]); $_[0] = Encode::decode_utf8($_[0]) if $ENCODE; - #return $l; return length($_[0]); - #$F[$i] = Encode::encode_utf8($F[$i]); - #return bytes::length($_[0]); } while (<>) { @@ -98,10 +90,6 @@ if ($ENCODE) { $sep_line = Encode::decode("UTF-8",$sep_line); $sep_line_last = Encode::decode("UTF-8",$sep_line_last); } -# NB 23.01.24 my $format = "| ".join(" | ",map {$t+=$_+3; "\%-".$_."s"} @len)." |".chr(10); -# NB 23.01.24 my $sep_line = "+".join("+",map {("-"x($_+2))} @len)."+".chr(10); -# NB 23.01.24 my $sep_line_first = $sep_line; -# NB 23.01.24 my $sep_line_last = $sep_line; # # Format / align @@ -141,7 +129,6 @@ while (my $line = shift @lines) } printf $format,@$line; - # NB 23.01.24 printf $format,map{$ENCODE ? Encode::encode_utf8($_) : $_} @$line; print $sep_line if $Opt{header} and !$i++; }