bug-parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Non ASCII characters don't work well with --bar option


From: Recursive G
Subject: Non ASCII characters don't work well with --bar option
Date: Wed, 30 Jun 2021 00:57:31 -0500

Hello. It seems some non-ASCII characters cannot be properly displayed
on the progress bar. Here's an example:

seq 100 | sed 's/^/naïve /' | parallel-20210622/src/parallel -j 4
--bar '(echo {} > /dev/null;sleep 0.1)'

My terminal encoding is UTF8. The ï is displayed as a question mark on
my system. The same issue occurs for zenity.
I have the following patch to at least make zenity display the
characters correctly.
I tried to apply the same fix to the terminal output, but the color
code is inserted in the middle of such multi-byte characters, so it's
still not displayed correctly.

--- parallel-20210622/src/parallel
+++ parallel-20210622-fixed/src/parallel
@@ -3860,6 +3860,7 @@
      $Global::newest_job->{'commandline'}->
      replace_placeholders(["\257<\257>"],0,0) : "";
  # These chars mess up display in the terminal
+ my $orig_arg = $arg;
  $arg =~ tr/[\011-\016\033\302-\365]//d;
  my $eta_dhms = ::seconds_to_time_units($eta);
  my $bar_text =
@@ -3872,7 +3873,7 @@
  my $width = int($terminal_width * $pctcomplete);
  substr($s,$width,0) = $reset;
  my $zenity = sprintf("%-${terminal_width}s",
-      substr("#   $eta sec $arg",
+      substr("#   $eta sec $orig_arg",
      0,$terminal_width));
  $s = "\r" . $zenity . "\r" . $pctcomplete*100 . # Prefix with zenity header
      "\r" . $rev . $s . $reset;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]