diff options
author | Dan Winship <danw@src.gnome.org> | 2000-10-19 02:59:21 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-10-19 02:59:21 +0800 |
commit | c03848ecdf2e370aaed618044f042d93fcda5f5c (patch) | |
tree | ac724c280b4aa9ee5d04afa3a80ccfb0f5d6edfa | |
parent | 4af109915aef59e9101d082d6a02880e9214b589 (diff) | |
download | gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.tar gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.tar.gz gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.tar.bz2 gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.tar.lz gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.tar.xz gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.tar.zst gsoc2013-evolution-c03848ecdf2e370aaed618044f042d93fcda5f5c.zip |
If unicode_get_utf8 returns -1, assume it was actually undeclared
* e-html-utils.c (e_text_to_html): If unicode_get_utf8 returns -1,
assume it was actually undeclared iso-8859-1 text.
svn path=/trunk/; revision=6002
-rw-r--r-- | e-util/ChangeLog | 14 | ||||
-rw-r--r-- | e-util/e-html-utils.c | 62 |
2 files changed, 18 insertions, 58 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index e4d70982a2..404b1a331f 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,12 +1,18 @@ +2000-10-18 Dan Winship <danw@helixcode.com> + + * e-html-utils.c (e_text_to_html): If unicode_get_utf8 returns -1, + assume it was actually undeclared iso-8859-1 text. + 2000-10-17 Jesse Pavel <jpavel@helixcode.com> - * ename/e-address-western.c: made the routines use the stardard e_strstrcase - instead of the included function that existed earlier. + * ename/e-address-western.c: made the routines use the stardard + e_strstrcase instead of the included function that existed + earlier. 2000-10-11 Iain Holmes <iain@helixcode.com> - * ename/e-address-western.c (e_address_western_parse): g_strconcat needs - to be NULL terminated or it goes funny. + * ename/e-address-western.c (e_address_western_parse): g_strconcat + needs to be NULL terminated or it goes funny. Tue Sep 26 16:48:49 2000 Christopher James Lahey <clahey@helixcode.com> diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index a53b00b003..ff23be5533 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -26,32 +26,6 @@ #include <glib.h> #include <unicode.h> -#if 0 -static int etth_interesting[] = { - 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x00 - 0x0f */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ - 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* sp - / */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 2, 1, 2, /* 0 - ? */ - 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ - O */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, /* P - _ */ - 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ` - o */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, /* p - del */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x80 - 0x8f */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x90 - 0x9f */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xa0 - 0xaf */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xb0 - 0xbf */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xc0 - 0xcf */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xd0 - 0xdf */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 /* 0xf0 - 0xff */ -}; -#endif - -#define ETTH_SPECIAL 1 -#define ETTH_PUNCTUATION 2 -#define ETTH_ESCAPED 3 -#define ETTH_EOF 4 - static char * check_size (char **buffer, int *buffer_size, char *out, int len) { @@ -127,9 +101,6 @@ char * e_text_to_html (const char *input, unsigned int flags) { const unsigned char *cur = input; -#if 0 - const unsigned char *end; -#endif char *buffer = NULL; char *out = NULL; int buffer_size = 0, col; @@ -148,10 +119,8 @@ e_text_to_html (const char *input, unsigned int flags) unicode_char_t u; unicode_get_utf8 (cur, &u); - - if (u < 0) u = '_'; - - if (unicode_isalpha (u) && (flags & E_TEXT_TO_HTML_CONVERT_URLS)) { + if (unicode_isalpha (u) && + (flags & E_TEXT_TO_HTML_CONVERT_URLS)) { char *tmpurl = NULL, *refurl = NULL, *dispurl = NULL; if (!strncasecmp (cur, "http://", 7) || @@ -188,28 +157,13 @@ e_text_to_html (const char *input, unsigned int flags) } unicode_get_utf8 (cur, &u); - - if (u < 0) u = '_'; } - -#if 0 - /* Skip until we need to care. */ - end = cur; - while (!etth_interesting[*end] || - (etth_interesting[*end] == ETTH_PUNCTUATION && - !(flags & E_TEXT_TO_HTML_CONVERT_URLS))) - end++; - - out = check_size (&buffer, &buffer_size, out, - end - cur + 10); - memcpy (out, cur, end - cur); - out += end - cur; - col += end - cur; - - if (!*end) - break; - cur = end; -#endif + if (u == (unicode_char_t)-1) { + /* Sigh. Someone sent undeclared 8-bit data. + * Assume it's iso-8859-1. + */ + u = *cur; + } out = check_size (&buffer, &buffer_size, out, 10); |