From 90de85d9f5905f92507b78f32a43e354a6181e2f Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 9 Apr 2001 13:24:30 +0000 Subject: create to_utf8 from po strings, use it for kdm message --- perl-install/any.pm | 2 ++ perl-install/c/stuff.xs.pm | 25 ++++++++++++++++++++++++- perl-install/install_steps.pm | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index 42d7f4283..001ff08aa 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -796,4 +796,6 @@ sub runlevel { } } +sub to_utf8 { c::to_utf8($lang::charset || 'ISO_8859-1', $_[0]) } + 1; diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 12d4c28a4..3fa08bc0a 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -455,7 +455,30 @@ from_utf8(s) char *buf = alloca(s_len + 10); /* 10 for safety, it should not be needed, utf8 is *always* bigger than a special encoding */ { char *ptr = buf; - int ptr_len = s_len; + int ptr_len = s_len + 10; + if ((iconv(cd, &s, &s_len, &ptr, &ptr_len)) != (size_t) (-1)) { + *ptr = 0; + RETVAL = buf; + } + } + iconv_close(cd); + } + OUTPUT: + RETVAL + +char * +to_utf8(charset, s) + char *charset + char *s + CODE: + iconv_t cd = iconv_open("utf-8", charset); + RETVAL = s; + if (cd != (iconv_t) (-1)) { + int s_len = strlen(RETVAL); + char *buf = alloca(2 * s_len + 10); /* 10 for safety, it should not be needed */ + { + char *ptr = buf; + int ptr_len = 2 * s_len + 10; if ((iconv(cd, &s, &s_len, &ptr, &ptr_len)) != (size_t) (-1)) { *ptr = 0; RETVAL = buf; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index d9ef8c497..83dbf3d61 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -447,7 +447,7 @@ Consoles 1,3,4,7 may also contain interesting information"; # log::l("updating kde icons according to available devices"); # install_any::kdeicons_postinstall($o->{prefix}); - my $welcome = _("Welcome to %s", "HOSTNAME"); + my $welcome = any::to_utf8(_("Welcome to %s", "HOSTNAME")); substInFile { s/^(GreetString)=.*/$1=$welcome/ } "$o->{prefix}/usr/share/config/kdmrc"; install_any::disable_user_view($o->{prefix}) if $o->{security} >= 3 || $o->{authentication}{NIS}; run_program::rooted($o->{prefix}, "kdeDesktopCleanup"); -- cgit v1.2.1