diff options
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/msg.pm | 17 | ||||
-rw-r--r-- | urpm/signature.pm | 5 |
2 files changed, 19 insertions, 3 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm index d5e618b3..c61a9187 100644 --- a/urpm/msg.pm +++ b/urpm/msg.pm @@ -7,9 +7,10 @@ no warnings; use Exporter; use URPM; +my $encoding; BEGIN { - eval { require encoding }; - eval "use open ':locale'" if eval { encoding::_get_locale_encoding() ne 'ANSI_X3.4-1968' }; + eval { require encoding; $encoding = encoding::_get_locale_encoding() }; + eval "use open ':locale'" if $encoding && $encoding ne 'ANSI_X3.4-1968'; } (our $VERSION) = q($Revision$) =~ /(\d+)/; @@ -29,6 +30,18 @@ URPM::bind_rpm_textdomain_codeset(); our $no_translation; +sub from_locale_encoding { + my ($s) = @_; + $encoding && eval { + require Encode; + Encode::decode($encoding, $s); + } || do { + require utf8; + utf8::decode($s); + $s; + } || $s; +} + sub translate { my ($s, $o_plural, $o_nb) = @_; my $res; diff --git a/urpm/signature.pm b/urpm/signature.pm index ccafa299..e18166a6 100644 --- a/urpm/signature.pm +++ b/urpm/signature.pm @@ -22,7 +22,10 @@ sub _check { $filepath !~ /\.spec$/ or next; $urpm->{debug} and $urpm->{debug}("verifying signature of $filepath"); - my $verif = URPM::verify_signature($filepath); + #- rpmlib is doing strftime %c, and so the string comes from the current encoding + #- (URPM::bind_rpm_textdomain_codeset() doesn't help here) + #- so we have to transform... + my $verif = urpm::msg::from_locale_encoding(URPM::verify_signature($filepath)); if ($verif =~ /NOT OK/) { $verif =~ s/\n//g; |