aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grpmi/rpm/grpmi_rpm.xs28
-rw-r--r--rpmdrake.spec3
2 files changed, 29 insertions, 2 deletions
diff --git a/grpmi/rpm/grpmi_rpm.xs b/grpmi/rpm/grpmi_rpm.xs
index f63cdca2..72b4de28 100644
--- a/grpmi/rpm/grpmi_rpm.xs
+++ b/grpmi/rpm/grpmi_rpm.xs
@@ -29,6 +29,8 @@
#include <sys/stat.h>
#include <errno.h>
#include <stdarg.h>
+#include <langinfo.h>
+#include <iconv.h>
#include "EXTERN.h"
#include "perl.h"
@@ -72,6 +74,30 @@ char * init_rcstuff_(void)
}
+/* bad bad bad.. duplicated code from gi/perl-install/c/stuff.xs */
+char* std_to_utf8(char* s)
+{
+ iconv_t cd = iconv_open("UTF-8", nl_langinfo(CODESET));
+ char* retval = s;
+ if (cd != (iconv_t) (-1)) {
+ size_t s_len = strlen(retval);
+ /* the maximum expansion when converting happens when converting
+ tscii to utf-8; each tscii char can become up to 4 unicode chars
+ and each one of those unicode chars can be 3 bytes long */
+ char *buf = alloca(4 * 3 * s_len);
+ {
+ char *ptr = buf;
+ size_t ptr_len = 4 * 3 * s_len;
+ if ((iconv(cd, &s, &s_len, &ptr, &ptr_len)) != (size_t) (-1)) {
+ *ptr = 0;
+ retval = buf;
+ }
+ }
+ iconv_close(cd);
+ }
+ return strdup(retval);
+}
+
/* these are in rpmlib but not in rpmlib.h */
int readLead(FD_t fd, struct rpmlead *lead);
int rpmReadSignature(FD_t fd, Header *header, short sig_type);
@@ -144,7 +170,7 @@ char * verify_sig_(char * file)
i = rpmVerifySignature(tmpfile, tag, ptr, count, result);
if (i != RPMSIG_OK) {
unlink(tmpfile);
- return strdup(result);
+ return std_to_utf8(result);
}
}
unlink(tmpfile);
diff --git a/rpmdrake.spec b/rpmdrake.spec
index a248f3a5..ee8cb698 100644
--- a/rpmdrake.spec
+++ b/rpmdrake.spec
@@ -116,10 +116,11 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorarch}/*.pm
%changelog
-* Fri Apr 4 2003 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1-15mdk
+* Tue Apr 8 2003 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1-15mdk
- rpmdrake: small UI change to follow #3610, e.g. in
"maximum information" mode, have the source and currently installed
version closer to the top
+- grpmi: fix yet again an UTF8 problem (#3676)
* Wed Mar 26 2003 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1-14mdk
- grpmi/curl_download: fixes for MandrakeClub: