Package: convmv
Version: 1.09-1
Severity: important
Tags: patch

When calling convmv with "-t utf-8", the program behaves differently from
using "-f utf8".

For example: 
======================
% convmv -f latin1 -t utf8 Plkr-AlloCiné.pdb
Starting a dry run without changes...
Skipping, already UTF-8: ./Plkr-AlloCiné.pdb
No changes to your files done. Use --notest to finally rename the files.

% convmv -f latin1 -t utf-8 Plkr-AlloCiné.pdb
Starting a dry run without changes...
mv "./Plkr-AlloCiné.pdb"        "./Plkr-AlloCiné.pdb"
No changes to your files done. Use --notest to finally rename the files.
======================


Using the following script, I tracked down the problem to an alias
resolution bug:
===========================
#!/usr/bin/perl -w

use strict;
use Encode;

my $opt_t = shift;
$opt_t=Encode::resolve_alias($opt_t) or die "wrong/unknown \"to\"
encoding!\n";
print "opt_t = $opt_t\n";
============================

Output:
========================
% ./utf8.pl utf8
opt_t = utf8
% ./utf8.pl utf-8
opt_t = utf-8-strict
========================

Therefore the following patch should solve the problem:
========================
--- /usr/bin/convmv     2006-01-19 03:21:33.000000000 +0100
+++ /tmp/convmv 2006-02-13 00:19:09.046541490 +0100
@@ -277,11 +277,11 @@
 } else {
        $opt_f=Encode::resolve_alias($opt_f) or die "wrong/unknown \"from\"
        encoding!\n";
        $opt_t=Encode::resolve_alias($opt_t) or die "wrong/unknown \"to\"
        encoding!\n";
-       $to_is_utf8 = lc($opt_t) =~ m/^utf-?8$/;
+       $to_is_utf8 = lc($opt_t) =~ m/^utf-?8(-strict)?$/;
        $checkenc=\&char_checkenc;
        $get_newname=\&char_get_newname;
 }
-$from_is_utf8 = lc($opt_f) =~ m/^utf-?8$/;
+$from_is_utf8 = lc($opt_f) =~ m/^utf-?8(-strict)?$/;

 if ($opt_qfrom) {
        $from_print=\&to_ascii;
=========================

 Regards

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-2-686-smp
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages convmv depends on:
ii  perl                          5.8.8-1    Larry Wall's Practical Extraction 

convmv recommends no packages.

-- no debconf information

Reply via email to