summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJeffrey Lee <me@phlamethrower.co.uk>2006-09-11 08:02:13 +0000
committerJeffrey Lee <me@phlamethrower.co.uk>2006-09-11 08:02:13 +0000
commit36278685ff2bd990109c502f69ec7d9b90f75b60 (patch)
tree0d8a5b2a099214183e7f46cdd170623650d9b975 /render
parent0f26a7397643a2b1a993d67cb2c2f80182b90397 (diff)
downloadnetsurf-36278685ff2bd990109c502f69ec7d9b90f75b60.tar.gz
netsurf-36278685ff2bd990109c502f69ec7d9b90f75b60.tar.bz2
Fixed translation of html entities when a textarea has an initial value
svn path=/trunk/netsurf/; revision=2952
Diffstat (limited to 'render')
-rw-r--r--render/box_construct.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index 3aef253fe..ef2df9fa1 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include "libxml/HTMLparser.h"
+#include "libxml/parserInternals.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
#include "netsurf/css/css.h"
@@ -2391,7 +2392,7 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
* Consecutive BR may not be present. These constraints are satisfied
* by using a 0-length TEXT for blank lines. */
- xmlChar *current;
+ xmlChar *current,*string,*null_string="";
xmlNode *n2;
xmlBufferPtr buf;
struct box *inline_container, *inline_box, *br_box;
@@ -2427,12 +2428,22 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
}
n2 = n2->next;
}
- current = buf->content;
+ xmlParserCtxtPtr ctxt = xmlCreateDocParserCtxt(buf->content);
+ string=0;
+ if(ctxt)
+ {
+ string = current = xmlStringDecodeEntities(ctxt,buf->content,XML_SUBSTITUTE_REF|XML_SUBSTITUTE_PEREF,0,0,0);
+ xmlFreeParserCtxt(ctxt);
+ }
+ if(!string)
+ string = current = null_string;
while (1) {
/* BOX_TEXT */
len = strcspn(current, "\r\n");
s = talloc_strndup(content, current, len);
if (!s) {
+ if(string != null_string)
+ xmlFree(string);
xmlBufferFree(buf);
return false;
}
@@ -2440,6 +2451,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
inline_box = box_create(box->style, 0, 0, box->title, 0,
content);
if (!inline_box) {
+ if(string != null_string)
+ xmlFree(string);
xmlBufferFree(buf);
return false;
}
@@ -2456,6 +2469,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
/* BOX_BR */
br_box = box_create(box->style, 0, 0, box->title, 0, content);
if (!br_box) {
+ if(string != null_string)
+ xmlFree(string);
xmlBufferFree(buf);
return false;
}
@@ -2467,6 +2482,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
else
current++;
}
+ if(string != null_string)
+ xmlFree(string);
xmlBufferFree(buf);
if (content->data.html.forms)