diff options
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-html-utils.c | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index bbc5ceeafc..027717987e 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2001-05-01 Dan Winship <danw@ximian.com> + + * e-html-utils.c (e_text_to_html_full): Don't use g_utf8_next_char + on text that isn't valid UTF8, since it won't work (and might even + get into an infinite loop). + 2001-04-29 Dan Winship <danw@ximian.com> * e-html-utils.c (email_address_extract): Make this smarter. Now diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index 3b40c6ae87..1561492454 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -198,7 +198,7 @@ is_citation (const unsigned char *c, gboolean saw_citation) char * e_text_to_html_full (const char *input, unsigned int flags, guint32 color) { - const unsigned char *cur, *linestart; + const unsigned char *cur, *next, *linestart; char *buffer = NULL; char *out = NULL; int buffer_size = 0, col; @@ -214,7 +214,7 @@ e_text_to_html_full (const char *input, unsigned int flags, guint32 color) col = 0; - for (cur = linestart = input; cur && *cur; cur = g_utf8_next_char (cur)) { + for (cur = linestart = input; cur && *cur; cur = next) { gunichar u; if (flags & E_TEXT_TO_HTML_MARK_CITATION && col == 0) { @@ -309,7 +309,9 @@ e_text_to_html_full (const char *input, unsigned int flags, guint32 color) * Assume it's iso-8859-1. */ u = *cur; - } + next = cur + 1; + } else + next = g_utf8_next_char (cur); out = check_size (&buffer, &buffer_size, out, 10); |