aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-html-utils.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-10-19 02:59:21 +0800
committerDan Winship <danw@src.gnome.org>2000-10-19 02:59:21 +0800
commitc03848ecdf2e370aaed618044f042d93fcda5f5c (patch)
treeac724c280b4aa9ee5d04afa3a80ccfb0f5d6edfa /e-util/e-html-utils.c
parent4af109915aef59e9101d082d6a02880e9214b589 (diff)
downloadgsoc2013-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
Diffstat (limited to 'e-util/e-html-utils.c')
-rw-r--r--e-util/e-html-utils.c62
1 files changed, 8 insertions, 54 deletions
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);