diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-10-07 12:12:25 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-10-07 12:12:25 +0000 |
commit | da614e5c351ebb07e82a55c77b4c713f28f6b6f1 (patch) | |
tree | 42360d3b67dcb6bbbffb05135faa8ede8d6c8273 /urpm/msg.pm | |
parent | 72e9a5dc416870a48850ff10c071200a13360ca7 (diff) | |
download | urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar.gz urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar.bz2 urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar.xz urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.zip |
- urpmi:
o fix displaying "bad signature" in non-utf8 (#44587)
Diffstat (limited to 'urpm/msg.pm')
-rw-r--r-- | urpm/msg.pm | 17 |
1 files changed, 15 insertions, 2 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; |