diff options
author | Lauris Kaplinski <lauris@src.gnome.org> | 2001-01-03 11:12:18 +0800 |
---|---|---|
committer | Lauris Kaplinski <lauris@src.gnome.org> | 2001-01-03 11:12:18 +0800 |
commit | 2934ba8dca1dd1ae21c45e53783129a2685717b2 (patch) | |
tree | 57adaf91e5fdef776a48f112f0ad9cd64ae68bc5 /filter | |
parent | 33e0d0e847cee22aaa127e3ae1e75c27cc41f5b4 (diff) | |
download | gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.tar gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.tar.gz gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.tar.bz2 gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.tar.lz gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.tar.xz gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.tar.zst gsoc2013-evolution-2934ba8dca1dd1ae21c45e53783129a2685717b2.zip |
Little utf8 safe encoding/decoding into libxml1 brokenness
svn path=/trunk/; revision=7226
Diffstat (limited to 'filter')
-rw-r--r-- | filter/ChangeLog | 12 | ||||
-rw-r--r-- | filter/filter-input.c | 13 | ||||
-rw-r--r-- | filter/filter-option.c | 12 | ||||
-rw-r--r-- | filter/filter-part.c | 19 | ||||
-rw-r--r-- | filter/filter-rule.c | 14 |
5 files changed, 58 insertions, 12 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index 9e931c4294..c35e870e39 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,15 @@ +2001-01-02 Lauris Kaplinski <lauris@helixcode.com> + + * filter-input.c (xml_encode): Encode utf8 + (xml_decode): Decode utf8 + + * filter-option.c (xml_create): Decode utf8 + + * filter-part.c (filter_part_xml_create): Decode utf8 + + * filter_rule.c (xml_encode): Encode utf8 + (xml_decode): Decode utf8 + 2001-01-02 Jeffrey Stedfast <fejj@helixcode.com> * filter-driver.c (do_flag): Set the 'dirty' flag - this should diff --git a/filter/filter-input.c b/filter/filter-input.c index 556b895ef1..d154e9c898 100644 --- a/filter/filter-input.c +++ b/filter/filter-input.c @@ -22,6 +22,7 @@ #include <gnome.h> #include <regex.h> +#include <gnome-xml/xmlmemory.h> #include <gal/widgets/e-unicode.h> #include "filter-input.h" @@ -226,9 +227,12 @@ xml_encode (FilterElement *fe) while (l) { xmlNodePtr cur; char *str = l->data; + char *encstr; cur = xmlNewChild (value, NULL, type, NULL); - xmlNodeSetContent (cur, str); + encstr = e_utf8_xml1_encode (str); + xmlNodeSetContent (cur, encstr); + g_free (encstr); l = g_list_next (l); } @@ -253,9 +257,12 @@ xml_decode (FilterElement *fe, xmlNodePtr node) n = node->childs; while (n) { if (!strcmp (n->name, type)) { + gchar *decstr; str = xmlNodeGetContent (n); - d(printf (" '%s'\n", str)); - fi->values = g_list_append (fi->values, str); + decstr = e_utf8_xml1_decode (str); + if (str) xmlFree (str); + d(printf (" '%s'\n", decstr)); + fi->values = g_list_append (fi->values, decstr); } else { g_warning ("Unknown node type '%s' encountered decoding a %s\n", n->name, type); } diff --git a/filter/filter-option.c b/filter/filter-option.c index a6bcaad8c1..658136f0cb 100644 --- a/filter/filter-option.c +++ b/filter/filter-option.c @@ -175,11 +175,19 @@ xml_create (FilterElement *fe, xmlNodePtr node) while (work) { if (!strcmp (work->name, "title")) { if (!op->title) { - op->title = xmlNodeGetContent (work); + gchar *str, *decstr; + str = xmlNodeGetContent (work); + decstr = e_utf8_xml1_decode (str); + if (str) xmlFree (str); + op->title = decstr; } } else if (!strcmp (work->name, "code")) { if (!op->code) { - op->code = xmlNodeGetContent (work); + gchar *str, *decstr; + str = xmlNodeGetContent (work); + decstr = e_utf8_xml1_decode (str); + if (str) xmlFree (str); + op->code = decstr; } } work = work->next; diff --git a/filter/filter-part.c b/filter/filter-part.c index dcd55ac92c..5d9df3a617 100644 --- a/filter/filter-part.c +++ b/filter/filter-part.c @@ -22,6 +22,7 @@ #include <gnome.h> #include <gnome-xml/xmlmemory.h> +#include <gal/widgets/e-unicode.h> #include "filter-part.h" #include "filter-element.h" @@ -154,11 +155,21 @@ filter_part_xml_create (FilterPart *ff, xmlNodePtr node) g_warning ("Invalid xml format, missing/unknown input type"); } } else if (!strcmp (n->name, "title")) { - if (!ff->title) - ff->title = xmlNodeGetContent (n); + if (!ff->title) { + gchar *str, *decstr; + str = xmlNodeGetContent (n); + decstr = e_utf8_xml1_decode (str); + if (str) xmlFree (str); + ff->title = decstr; + } } else if (!strcmp (n->name, "code")) { - if (!ff->code) - ff->code = xmlNodeGetContent (n); + if (!ff->code) { + gchar *str, *decstr; + str = xmlNodeGetContent (n); + decstr = e_utf8_xml1_decode (str); + if (str) xmlFree (str); + ff->code = decstr; + } } else { g_warning ("Unknwon part element in xml: %s\n", n->name); } diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 17173a1c97..663e9d7f81 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -182,8 +182,11 @@ xml_encode (FilterRule *fr) } if (fr->name) { + gchar *encstr; work = xmlNewNode (NULL, "title"); - xmlNodeSetContent (work, fr->name); + encstr = e_utf8_xml1_encode (fr->name); + xmlNodeSetContent (work, encstr); + g_free (encstr); xmlAddChild (node, work); } @@ -264,8 +267,13 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f) if (!strcmp (work->name, "partset")) { load_set (work, fr, f); } else if (!strcmp (work->name, "title")) { - if (!fr->name) - fr->name = xmlNodeGetContent (work); + if (!fr->name) { + gchar *str, *decstr; + str = xmlNodeGetContent (work); + decstr = e_utf8_xml1_decode (str); + if (str) xmlFree (str); + fr->name = decstr; + } } work = work->next; } |