From f9f392b97bb7b510c25dcd72db49c747715784b9 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 22 Jul 2005 04:03:31 +0000 Subject: [PATCH] * HTML messages in foreign character sets are now converted to UTF-8 for display. --- webcit/ChangeLog | 5 ++++- webcit/html2html.c | 40 +++++++++++++++++++++++++++++++++++++++- webcit/messages.c | 2 +- webcit/webcit.h | 2 +- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 125fb66b7..2830db543 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 619.30 2005/07/22 04:03:30 ajc +* HTML messages in foreign character sets are now converted to UTF-8 for + display. + Revision 619.29 2005/07/22 03:40:22 ajc * Handle display of RFC2047-encoded subjects and senders by converting them to UTF-8 (all WebCit pages are output as UTF-8). Resolves bug #136. @@ -2728,4 +2732,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/html2html.c b/webcit/html2html.c index 271dbe143..110d9682e 100644 --- a/webcit/html2html.c +++ b/webcit/html2html.c @@ -24,14 +24,21 @@ #include #include #include + +#ifdef HAVE_ICONV +#include +#endif + #include "webcit.h" #include "vcard.h" #include "webserver.h" /* + * Sanitize and enhance an HTML message for display. + * Also convert weird character sets to UTF-8 if necessary. */ -void output_html(void) { +void output_html(char *charset) { char buf[SIZ]; char *msg; char *ptr; @@ -47,6 +54,14 @@ void output_html(void) { int alevel = 0; int i; int linklen; +#ifdef HAVE_ICONV + iconv_t ic = (iconv_t)(-1) ; + char *ibuf; /* Buffer of characters to be converted */ + char *obuf; /* Buffer for converted characters */ + size_t ibuflen; /* Length of input buffer */ + size_t obuflen; /* Length of output buffer */ + char *osav; /* Saved pointer to output buffer */ +#endif msg = strdup(""); sprintf(new_window, "