summaryrefslogtreecommitdiffstats
path: root/urpm/msg.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-07 13:56:47 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-07 13:56:47 +0000
commit625bba974d72f896199016b0806e0fd8e0e7b4fb (patch)
treedb99ab6c4f8ca9c42ca5c03cef02a431ab7762cf /urpm/msg.pm
parent881cda9a0cd89e1adac04393b3d209d481505104 (diff)
downloadurpmi-625bba974d72f896199016b0806e0fd8e0e7b4fb.tar
urpmi-625bba974d72f896199016b0806e0fd8e0e7b4fb.tar.gz
urpmi-625bba974d72f896199016b0806e0fd8e0e7b4fb.tar.bz2
urpmi-625bba974d72f896199016b0806e0fd8e0e7b4fb.tar.xz
urpmi-625bba974d72f896199016b0806e0fd8e0e7b4fb.zip
Don't decode utf-8 text when the locale charset is itself in utf-8.
Optimize utf-8 text manipulations.
Diffstat (limited to 'urpm/msg.pm')
-rw-r--r--urpm/msg.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm
index 28e3438d..2c559395 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -26,7 +26,9 @@ defined $codeset or eval {
sub from_utf8_full { Locale::gettext::iconv($_[0], "UTF-8", $codeset) }
sub from_utf8_dummy { $_[0] }
-*from_utf8 = defined $codeset ? *from_utf8_full : *from_utf8_dummy;
+our $use_utf8_full = defined $codeset && $codeset eq 'UTF-8';
+
+*from_utf8 = $use_utf8_full ? *from_utf8_full : *from_utf8_dummy;
sub import {
urpm::msg->export_to_level(1, @_);
@@ -43,7 +45,7 @@ sub N {
eval { Locale::gettext::gettext($format || '') } || $format,
@params,
);
- utf8::decode($s);
+ utf8::decode($s) unless $use_utf8_full;
$s;
}