Randomize certificate serials to prevent chosen prefix hash collision
[openxpki.git] / trunk / i18n / convert.pl
blob5d54598c3af6a5579911797dc3d4f66f4fc3458a
1 #!/usr/bin/perl -w
3 # Copyright (C) 2004 Michael Bell.
4 # License: GPL version 2
6 our $iconv = "iconv";
7 our $QUIET_ARG = 0;
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";
15 my $ret = `$command`;
16 print $ret;
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>
29 sub get_po_encoding
31 my ($in_po_file) = @_;
32 my $encoding = "";
34 open IN_PO_FILE, $in_po_file or die;
35 while (<IN_PO_FILE>)
37 ## example: "Content-Type: text/plain; charset=ISO-8859-1\n"
38 if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/)
40 $encoding = $1;
41 last;
44 close IN_PO_FILE;
46 if (!$encoding)
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");
53 if ($?) {
54 $encoding = get_local_charset($encoding);
57 return $encoding