summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2002-09-11 21:19:24 +0000
committerJames Bursa <james@netsurf-browser.org>2002-09-11 21:19:24 +0000
commit1e5061507b7c5d61b0f0152abb6faa728906a61e (patch)
treec037f71ffa6a73091e022304c179877d38aeebf2 /render/box.c
parent0380dbb75d60d7543236989407e2e8fda5142383 (diff)
downloadnetsurf-1e5061507b7c5d61b0f0152abb6faa728906a61e.tar.gz
netsurf-1e5061507b7c5d61b0f0152abb6faa728906a61e.tar.bz2
[project @ 2002-09-11 21:19:24 by bursa]
Convert all text to iso-8859-1 (temporary fix). svn path=/import/netsurf/; revision=35
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/render/box.c b/render/box.c
index ee9f5b1b4..2be09b223 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1,5 +1,5 @@
/**
- * $Id: box.c,v 1.13 2002/09/11 14:24:02 monkeyson Exp $
+ * $Id: box.c,v 1.14 2002/09/11 21:19:24 bursa Exp $
*/
#include <assert.h>
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include "libxml/HTMLparser.h"
+#include "utf-8.h"
#include "netsurf/render/css.h"
#include "netsurf/render/font.h"
#include "netsurf/render/box.h"
@@ -73,6 +74,24 @@ struct box * box_create(xmlNode * node, box_type type, struct css_style * style,
return box;
}
+
+char * tolat1(const xmlChar * s)
+{
+ char *d = xcalloc(strlen(s) + 1, sizeof(char));
+ char *d0 = d;
+ unsigned int u, chars;
+
+ while (*s != 0) {
+ u = sgetu8(s, &chars);
+ s += chars;
+ *d = u < 0x100 ? u : '?';
+ d++;
+ }
+ *d = 0;
+
+ return d0;
+}
+
/**
* make a box tree with style data from an xml tree
*
@@ -147,7 +166,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
}
if (n->type == XML_TEXT_NODE) {
box = box_create(n, BOX_INLINE, parent_style, href);
- box->text = squash_whitespace((char *) n->content);
+ box->text = squash_whitespace(tolat1(n->content));
box->length = strlen(box->text);
box_add_child(inline_container, box);
} else {