Mercurial > pidgin
comparison src/xmlnode.c @ 14171:d38d8716426c
[gaim-migrate @ 16821]
Patch #1523103 ("Improved markup processing"):
"This patch tries to handle all the html-entities
(including stuff like ® and &#xx;) in
gaim_markup_strip_html and gaim_unescape_html.
This also allows fixing the issue with libxml2 where
& was being converted to &."
committer: Tailor Script <tailor@pidgin.im>
| author | Sadrul Habib Chowdhury <imadil@gmail.com> |
|---|---|
| date | Fri, 18 Aug 2006 00:15:25 +0000 |
| parents | 8bda65b88e49 |
| children |
comparison
equal
deleted
inserted
replaced
| 14170:b1ce2e9e494a | 14171:d38d8716426c |
|---|---|
| 33 #include <libxml/parser.h> | 33 #include <libxml/parser.h> |
| 34 #endif | 34 #endif |
| 35 #include <string.h> | 35 #include <string.h> |
| 36 #include <glib.h> | 36 #include <glib.h> |
| 37 | 37 |
| 38 #include "util.h" | |
| 38 #include "xmlnode.h" | 39 #include "xmlnode.h" |
| 39 | 40 |
| 40 #ifdef _WIN32 | 41 #ifdef _WIN32 |
| 41 # define NEWLINE_S "\r\n" | 42 # define NEWLINE_S "\r\n" |
| 42 #else | 43 #else |
| 404 for(i=0; i < nb_attributes * 5; i+=5) { | 405 for(i=0; i < nb_attributes * 5; i+=5) { |
| 405 int attrib_len = attributes[i+4] - attributes[i+3]; | 406 int attrib_len = attributes[i+4] - attributes[i+3]; |
| 406 char *attrib = g_malloc(attrib_len + 1); | 407 char *attrib = g_malloc(attrib_len + 1); |
| 407 memcpy(attrib, attributes[i+3], attrib_len); | 408 memcpy(attrib, attributes[i+3], attrib_len); |
| 408 attrib[attrib_len] = '\0'; | 409 attrib[attrib_len] = '\0'; |
| 410 #ifdef HAVE_LIBXML | |
| 411 char *txt = attrib; | |
| 412 attrib = gaim_unescape_html(txt); | |
| 413 g_free(txt); | |
| 414 #endif | |
| 409 xmlnode_set_attrib(node, attributes[i], attrib); | 415 xmlnode_set_attrib(node, attributes[i], attrib); |
| 410 g_free(attrib); | 416 g_free(attrib); |
| 411 } | 417 } |
| 412 | 418 |
| 413 xpd->current = node; | 419 xpd->current = node; |
