diff options
author | Pablo Saratxaga <pablo@mandriva.com> | 2004-09-01 05:48:56 +0000 |
---|---|---|
committer | Pablo Saratxaga <pablo@mandriva.com> | 2004-09-01 05:48:56 +0000 |
commit | 8e20330548a2756730ecf0b9d2aa0cd7da25ee68 (patch) | |
tree | 06e75fadf4efb316b27ae427fceea761cf0873e8 | |
parent | c891a580bf230db7ee6193950de954bf7f0972b3 (diff) | |
download | rpmdrake-8e20330548a2756730ecf0b9d2aa0cd7da25ee68.tar rpmdrake-8e20330548a2756730ecf0b9d2aa0cd7da25ee68.tar.gz rpmdrake-8e20330548a2756730ecf0b9d2aa0cd7da25ee68.tar.bz2 rpmdrake-8e20330548a2756730ecf0b9d2aa0cd7da25ee68.tar.xz rpmdrake-8e20330548a2756730ecf0b9d2aa0cd7da25ee68.zip |
fixed display of localtime;
handled case where LC_COLLATE is overwritten by LC_ALL
-rwxr-xr-x | rpmdrake | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -47,11 +47,18 @@ use common; use rpmdrake; use gurpm; -#- dirty stuff needed because text printed by gtk2 will always be encoded in UTF-8 +#- dirty stuff needed because text printed by gtk2 will always be encoded +#- in UTF-8; we first check if LC_ALL is defiend, because if it is, +#- changinf LC_COLLATE alone will have no effect. use POSIX; use locale; -my $collation_locale = setlocale(LC_COLLATE); -$collation_locale =~ /UTF-8/ or setlocale(LC_COLLATE, "$collation_locale.UTF-8"); +my $collation_locale = $ENV{LC_ALL}; +if ($collation_locale) { + $collation_locale =~ /UTF-8/ or setlocale(LC_ALL, "$collation_locale.UTF-8"); } +else { + $collation_locale = setlocale(LC_COLLATE); + $collation_locale =~ /UTF-8/ or setlocale(LC_COLLATE, "$collation_locale.UTF-8"); +}; $MODE = 'install'; @@ -256,7 +263,13 @@ sub pkg2medium { $tmp; } -sub localtime2changelog { strftime("%c", localtime($_[0])) } +#- strftime returns a string in the locale charset encoding; +#- but gtk2 requires UTF-8, so we use to_utf8() to ensure the +#- output of localtime2changelog() is always in UTF-8 +#- as to_utf8() uses LC_CTYPE for locale encoding and strftime() uses LC_TIME, +#- it doesn't work if those two variables have values with different +#- encodings; but if a user has a so broken setup we can't do much anyway +sub localtime2changelog { to_utf8(strftime("%c", localtime($_[0]))) } sub extract_header { my ($pkg, $urpm) = @_; |