On Monday, February 23, 2009 at 22:03, Roman Mamedov wrote:
[..]
> > I don't know - atool uses 'use locale' and then checks that each
> > character is printable in the current locale using POSIX::isprint.
> > The problem may be related to UTF-8 and that perhaps perl is not in
> > UTF-8 mode by default, or that atool isn't iterating over characters
> > correctly.  I have no problems with characters like åäöÅÄÖ in my
> > ISO-8859-1 (en_GB.ISO-8859-1) locale though.

Here's a patch that should fix the problem in both UTF-8 and non-UTF-8
locales. Please give it a try.

Regards,

Oskar
--- /home/usel/atool    2008-06-08 18:20:09.000000000 +0200
+++ atool       2009-02-23 19:39:57.000000000 +0100
@@ -23,6 +23,14 @@
 # This file uses tab stops with a length of two.
 #

+# XXX: We could use -CLSDA but 5.10.0 has a bug which prevents us from
+# specifying this with shebang.
+if (${^UTF8LOCALE}) {
+  use Encode qw(decode_utf8);
+  binmode( $_, ":encoding(UTF-8)") for \*STDIN, \*STDOUT, \*STDERR;
+  $_ = decode_utf8( $_ ) for @ARGV, values %ENV;
+}
+
 use File::Basename;
 use File::Spec;
 use Getopt::Long;
@@ -1630,7 +1639,7 @@
       $out .= "\\\\";
     } elsif ($ch eq "'") {
       $out .= "\\'";
-    } elsif (!POSIX::isprint($ch)) {
+    } elsif ($ch !~ /[[:print:]]/) {
       $out .= sprintf('\\%03o', ord($ch));
     } else {
       $out .= $ch;

Reply via email to