From a4e6acb7d49063a117261eaf85f31fcfd281bfe7 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 15 Dec 2005 09:14:01 +0000 Subject: - i had foolishly removed c::iconv whereas it was used still used by c::from_utf8 and c::to_utf8 - anyway, moving c::from_utf8 and c::to_utf8 to common::from_utf8 and common::to_utf8 - making them use Locale::gettext::iconv - Locale::gettext::iconv transform undef into standard charset (1.05-2mdk) - drop c::standard_charset (now unused) --- perl-install/c/stuff.pm | 3 --- perl-install/c/stuff.xs.pl | 7 ------- perl-install/common.pm | 9 +++++++++ perl-install/install_steps_gtk.pm | 4 ++-- perl-install/lang.pm | 2 +- perl-install/network/modem.pm | 2 +- perl-install/wizards.pm | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/perl-install/c/stuff.pm b/perl-install/c/stuff.pm index 405f896cd..37e0c9a3b 100644 --- a/perl-install/c/stuff.pm +++ b/perl-install/c/stuff.pm @@ -11,7 +11,4 @@ $VERSION = '0.01'; c::stuff->bootstrap($VERSION); -sub from_utf8 { iconv($_[0], "utf-8", standard_charset()) } -sub to_utf8 { iconv($_[0], standard_charset(), "utf-8") } - 1; diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 59c842993..8ad3fd82d 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -666,13 +666,6 @@ upgrade_utf8(s) CODE: sv_utf8_upgrade(s); -char * -standard_charset() - CODE: - RETVAL = nl_langinfo(CODESET); - OUTPUT: - RETVAL - void get_iso_volume_ids(int fd) INIT: diff --git a/perl-install/common.pm b/perl-install/common.pm index c88451d85..0894bef71 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -68,6 +68,15 @@ sub translate { $s; } +sub from_utf8 { + my ($s) = @_; + Locale::gettext::iconv($s, "utf-8", undef); #- undef = locale charmap = nl_langinfo(CODESET) +} +sub to_utf8 { + my ($s) = @_; + Locale::gettext::iconv($s, undef, "utf-8"); #- undef = locale charmap = nl_langinfo(CODESET) +} + #- This is needed because text printed by Gtk2 will always be encoded #- in UTF-8; #- we first check if LC_ALL is defined, because if it is, changing diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 98888fbec..4c16cbcaf 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -301,7 +301,7 @@ sub choosePackagesTree { [ N("Version: "), $tag ], [ $p->version . '-' . $p->release . "\n" ], [ N("Size: "), $tag ], [ N("%d KB\n", $p->size / 1024) ], if_($imp, [ N("Importance: "), $tag ], [ "$imp\n" ]), - [ "\n" ], [ formatLines(c::from_utf8($p->description)) ] ]; + [ "\n" ], [ formatLines(common::from_utf8($p->description)) ] ]; }, toggle_nodes => sub { my $set_state = shift @_; @@ -502,7 +502,7 @@ sub installPackages { } elsif ($type eq 'open') { gtkval_modify(\$pkg_progress, 0); my $p = $packages->{depslist}[$id]; - mygtk2::gtkadd($pkg_log_widget, text => sprintf("\n%s: %s", $p->name, (split /\n/, c::from_utf8($p->summary))[0] || '')); + mygtk2::gtkadd($pkg_log_widget, text => sprintf("\n%s: %s", $p->name, (split /\n/, common::from_utf8($p->summary))[0] || '')); $current_total_size += $last_size; $last_size = $p->size; $advertize->(1) if $show_advertising && $total_size > 20_000_000 && time() - $change_time > 20; diff --git a/perl-install/lang.pm b/perl-install/lang.pm index e4e6df54d..9426825c9 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -1138,7 +1138,7 @@ sub write { if (!$b_user_only) { my $kde_charset = charset2kde_charset(l2charset($locale->{lang})); - my $welcome = c::to_utf8(N("Welcome to %s", '%n')); + my $welcome = common::to_utf8(N("Welcome to %s", '%n')); log::explanations(qq(Configuring KDM/MdkKDM)); substInFile { s/^(GreetString)=.*/$1=$welcome/; diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm index 9b0a9c3f3..29afb69a4 100644 --- a/perl-install/network/modem.pm +++ b/perl-install/network/modem.pm @@ -156,7 +156,7 @@ END $toreplace{$_->[0]} = $modem->{$_->[0]} || $_->[1] foreach [ 'Timeout', 60 ], [ 'UseLockFile', 1 ], [ 'Enter', 'CR' ], [ 'Volume', 0 ], [ 'BusyWait', 0 ], [ 'FlowControl', 'CRTSCTS' ], [ 'Speed', 115200 ]; - output($modem->{kppprc} || "$::prefix/usr/share/config/kppprc", c::to_utf8(<{kppprc} || "$::prefix/usr/share/config/kppprc", common::to_utf8(<do_pkgs->is_installed($rpm); - if ($in->ask_okcancel(N("Error"), N("%s is not installed\nClick \"Next\" to install or \"Cancel\" to quit", c::from_utf8($rpm)))) { + if ($in->ask_okcancel(N("Error"), N("%s is not installed\nClick \"Next\" to install or \"Cancel\" to quit", common::from_utf8($rpm)))) { $::testing and next; if (!$in->do_pkgs->install($rpm)) { local $::Wizard_finished = 1; -- cgit v1.2.1