Bug 25501: Supress warnings on installing translation
authorJulian Maurice <julian.maurice@biblibre.com>
Tue, 19 May 2020 13:05:41 +0000 (10:05 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 19 May 2020 14:19:56 +0000 (15:19 +0100)
To test:
1) Verify the error installing translations for any language
2) Apply the patch
3) Repeat 1), check warning is gone

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

misc/translator/tmpl_process3.pl

index 68c58f0..21a19f0 100755 (executable)
@@ -302,7 +302,7 @@ for my $in_dir ( @in_dirs ) {
 }
 
 # restores the string list from file
-$href = Locale::PO->load_file_ashash($str_file);
+$href = Locale::PO->load_file_ashash($str_file, 'utf-8');
 
 # guess the charsets. HTML::Templates defaults to iso-8859-1
 if (defined $href) {
@@ -465,7 +465,7 @@ if ($action eq 'create')  {
             VerboseWarnings::set_input_file_name $input;
             mkdir_recursive($targetdir) unless -d $targetdir;
             print STDERR "Creating $target...\n" unless $quiet;
-            open( OUTPUT, ">$target" ) || die "$target: $!\n";
+            open( OUTPUT, ">:encoding(UTF-8)", "$target" ) || die "$target: $!\n";
             text_replace( $h, *OUTPUT );
             close OUTPUT;
         } else {