summaryrefslogtreecommitdiffstats
path: root/perl-install/c/stuff.xs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-04-09 13:24:30 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-04-09 13:24:30 +0000
commit90de85d9f5905f92507b78f32a43e354a6181e2f (patch)
tree2d73135f408525b979b0ff37754dc41c339c4e21 /perl-install/c/stuff.xs.pm
parentb9d6263e1d1806a04ee58648c95db915e6cc0ad2 (diff)
downloaddrakx-backup-do-not-use-90de85d9f5905f92507b78f32a43e354a6181e2f.tar
drakx-backup-do-not-use-90de85d9f5905f92507b78f32a43e354a6181e2f.tar.gz
drakx-backup-do-not-use-90de85d9f5905f92507b78f32a43e354a6181e2f.tar.bz2
drakx-backup-do-not-use-90de85d9f5905f92507b78f32a43e354a6181e2f.tar.xz
drakx-backup-do-not-use-90de85d9f5905f92507b78f32a43e354a6181e2f.zip
create to_utf8 from po strings, use it for kdm message
Diffstat (limited to 'perl-install/c/stuff.xs.pm')
-rw-r--r--perl-install/c/stuff.xs.pm25
1 files changed, 24 insertions, 1 deletions
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;