From 23bcf6e31ad55d873c00ce3337057106ee471c47 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 16 May 2001 22:30:44 +0000 Subject: add E_TEXT_TO_HTML_ESCAPE_8BIT to turn non-US-ASCII characters into "?"s. * e-html-utils.c (e_text_to_html_full): add E_TEXT_TO_HTML_ESCAPE_8BIT to turn non-US-ASCII characters into "?"s. svn path=/trunk/; revision=9859 --- e-util/ChangeLog | 6 ++++++ e-util/e-html-utils.c | 7 ++++++- e-util/e-html-utils.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/e-util/ChangeLog b/e-util/ChangeLog index d0cf6a5369..6c0a558e3d 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2001-05-16 Dan Winship + + * e-html-utils.c (e_text_to_html_full): add + E_TEXT_TO_HTML_ESCAPE_8BIT to turn non-US-ASCII characters into + "?"s. + 2001-05-14 Jon Trowbridge * e-html-utils.c (is_citation): Check for bad utf8. diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index e79d5e2192..6d3eaebcc9 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -194,6 +194,8 @@ is_citation (const unsigned char *c, gboolean saw_citation) * * - E_TEXT_TO_HTML_MARK_CITATION: wrap around * citations (lines beginning with "> ", etc). + * + * - E_TEXT_TO_HTML_ESCAPE_8BIT: flatten everything to US-ASCII **/ char * e_text_to_html_full (const char *input, unsigned int flags, guint32 color) @@ -382,7 +384,10 @@ e_text_to_html_full (const char *input, unsigned int flags, guint32 color) /* Default case, just copy. */ *out++ = u; } else { - out += g_snprintf(out, 9, "&#%d;", u); + if (flags & E_TEXT_TO_HTML_ESCAPE_8BIT) + *out++ = '?'; + else + out += g_snprintf(out, 9, "&#%d;", u); } col++; break; diff --git a/e-util/e-html-utils.h b/e-util/e-html-utils.h index e95ca6e24a..d7c0c3b060 100644 --- a/e-util/e-html-utils.h +++ b/e-util/e-html-utils.h @@ -31,6 +31,7 @@ #define E_TEXT_TO_HTML_CONVERT_URLS (1 << 3) #define E_TEXT_TO_HTML_MARK_CITATION (1 << 4) #define E_TEXT_TO_HTML_CONVERT_ADDRESSES (1 << 5) +#define E_TEXT_TO_HTML_ESCAPE_8BIT (1 << 6) char *e_text_to_html_full (const char *input, unsigned int flags, guint32 color); char *e_text_to_html (const char *input, unsigned int flags); -- cgit v1.2.3