3 # Copyright (C) 2004 Michael Bell.
4 # License: GPL version 2
9 my $po_file = $ARGV[0];
10 print STDERR
"Translation file: $po_file\n";
11 my $encoding = get_po_encoding
($po_file);
13 my $command = "$iconv -f $encoding -t UTF-8 $po_file";
14 print STDERR
"Final command: $command\n";
18 # Original code taken from:
20 # The Intltool Message Merger
22 # Copyright (C) 2000, 2003 Free Software Foundation.
23 # Copyright (C) 2000, 2001 Eazel, Inc
25 # Authors: Maciej Stachowiak <mjs@noisehavoc.org>
26 # Kenneth Christiansen <kenneth@gnu.org>
27 # Darin Adler <darin@bentspoon.com>
31 my ($in_po_file) = @_;
34 open IN_PO_FILE
, $in_po_file or die;
37 ## example: "Content-Type: text/plain; charset=ISO-8859-1\n"
38 if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/)
48 print STDERR
"Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG;
49 $encoding = "ISO-8859-1";
52 system ("$iconv -f $encoding -t UTF-8 </dev/null 2>/dev/null");
54 $encoding = get_local_charset
($encoding);