From 1e5061507b7c5d61b0f0152abb6faa728906a61e Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 11 Sep 2002 21:19:24 +0000 Subject: [project @ 2002-09-11 21:19:24 by bursa] Convert all text to iso-8859-1 (temporary fix). svn path=/import/netsurf/; revision=35 --- makefile | 10 ++++++---- render/box.c | 23 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index c9f1de94f..ae97dd22d 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.2 2002/09/11 14:24:02 monkeyson Exp $ +# $Id: makefile,v 1.3 2002/09/11 21:19:24 bursa Exp $ all: netsurf,ff8 clean: @@ -8,7 +8,8 @@ FLAGS = -g -Wall -W -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-qual \ -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -std=c9x \ -I.. -I../../Tools/libxml2/include -I../../Tools/oslib \ - -I../../Tools/curl/include -Dfd_set=long -mpoke-function-name + -I../../Tools/curl/include -I../../Tools/libutf-8 \ + -Dfd_set=long -mpoke-function-name CC = riscos-gcc OBJECTS = render/objs-riscos/utils.o render/objs-riscos/css.o \ render/objs-riscos/css_enum.o render/objs-riscos/box.o \ @@ -19,13 +20,14 @@ OBJECTS = render/objs-riscos/utils.o render/objs-riscos/css.o \ HEADERS = render/box.h render/css.h render/css_enum.h \ render/layout.h render/utils.h riscos/font.h riscos/gui.h \ desktop/browser.h desktop/fetch.h desktop/gui.h desktop/netsurf.h -LIBS = ../../Tools/libxml2/libxml.ro ../../Tools/oslib/oslib.o ../../Tools/curl/libcurl.ro +LIBS = ../../Tools/libxml2/libxml.ro ../../Tools/oslib/oslib.o \ + ../../Tools/curl/libcurl.ro ../../Tools/libutf-8/libutf-8.ro netsurf,ff8: $(OBJECTS) $(CC) $(FLAGS) -o netsurf,ff8 $(OBJECTS) $(LIBS) render/css_enum.c render/css_enum.h: render/css_enums render/makeenum - render/makeenum render/css_enum < render/css_enums + cd ..; netsurf/render/makeenum netsurf/render/css_enum < netsurf/render/css_enums render/objs-riscos/%.o: render/%.c $(HEADERS) $(CC) $(FLAGS) -o $@ -c $< 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 @@ -8,6 +8,7 @@ #include #include #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 { -- cgit v1.2.3