From 736d7a72e2504fcfbff2a2979a111a874df9883f Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Tue, 28 Apr 2020 14:42:56 -0300 Subject: [PATCH] Bug 25305: fix double encoding in translation files Changes inroduced in Bug 24217 and Bug 24365 are producing strings with double encoding Don't know exactly what is producing the problem, but I propose a fix There are two changes, a feature limited use of Modern::Perl and preventing double encoding in output file. To test: 1) Create translation files for a new language ( cd misc/translator; ./translate create xx-YY) 2) Verify double encoding egrep "Aix-Marseille|Jean Prunier|periodika|Bokm" misc/translator/po/xx-YY-* check strange strings 3) Apply the patch 4) Create po files again ( cd misc/translator; rm -f po/xx-YY*; ./translate create xx-YY) 5) Verify no more double encoding egrep "Aix-Marseille|Jean Prunier|periodika|Bokm" misc/translator/po/xx-YY-* check normal strings --- misc/translator/TmplTokenizer.pm | 2 +- misc/translator/xgettext.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index b092ba61d7..1edc9e0d4f 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -1,6 +1,6 @@ package TmplTokenizer; -use Modern::Perl; +use Modern::Perl '2010'; use C4::TmplTokenType; use C4::TmplToken; use C4::TTParser; diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl index 89e01eed5b..889baf64a7 100755 --- a/misc/translator/xgettext.pl +++ b/misc/translator/xgettext.pl @@ -367,7 +367,7 @@ usage_error('You cannot specify both --convert-from and --files-from') if (defined $output && $output ne '-') { print STDERR "$0: Opening output file \"$output\"\n" if $verbose_p; - open($OUTPUT, '>:encoding(utf-8)', $output) || die "$output: $!\n"; + open($OUTPUT, '>', $output) || die "$output: $!\n"; } else { print STDERR "$0: Outputting to STDOUT...\n" if $verbose_p; open($OUTPUT, ">&STDOUT"); -- 2.17.1