diff --git a/ChangeLog b/ChangeLog index b056986a..9752ebdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Jul 13 18:35:47 CEST 2005 Daniel Veillard + + * HTMLparser.c: applied UTF-8 script parsing bug #310229 fix from + Jiri Netolicky + * result/HTML/script2.html* test/HTML/script2.html: added the test + case from the regression suite + Tue Jul 12 17:08:11 CEST 2005 Daniel Veillard * nanohttp.c: fixed bug #310105 with http_proxy environments with diff --git a/HTMLparser.c b/HTMLparser.c index c6115d03..d7246209 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2629,10 +2629,10 @@ static void htmlParseScript(htmlParserCtxtPtr ctxt) { xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 1]; int nbchar = 0; - xmlChar cur; + int cur,l; SHRINK; - cur = CUR; + cur = CUR_CHAR(l); while (IS_CHAR_CH(cur)) { if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') && (NXT(3) == '-')) { @@ -2648,7 +2648,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } nbchar = 0; htmlParseComment(ctxt); - cur = CUR; + cur = CUR_CHAR(l); continue; } else if ((cur == '<') && (NXT(1) == '/')) { /* @@ -2661,7 +2661,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { ((NXT(2) >= 'a') && (NXT(2) <= 'z'))) break; /* while */ } - buf[nbchar++] = cur; + COPY_BUF(l,buf,nbchar,cur); if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { if (ctxt->sax->cdataBlock!= NULL) { /* @@ -2673,8 +2673,8 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } nbchar = 0; } - NEXT; - cur = CUR; + NEXTL(l); + cur = CUR_CHAR(l); } if (!(IS_CHAR_CH(cur))) { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, diff --git a/result/HTML/script2.html b/result/HTML/script2.html new file mode 100644 index 00000000..9677f3c2 --- /dev/null +++ b/result/HTML/script2.html @@ -0,0 +1,14 @@ + + + + +Test Page + +
+

+ Příliš žluťoučký kůň úpěl ďábelksé ódy; +

+
+ diff --git a/result/HTML/script2.html.err b/result/HTML/script2.html.err new file mode 100644 index 00000000..e69de29b diff --git a/result/HTML/script2.html.sax b/result/HTML/script2.html.sax new file mode 100644 index 00000000..1607ccbf --- /dev/null +++ b/result/HTML/script2.html.sax @@ -0,0 +1,50 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.internalSubset(html, -//W3C//DTD XHTML 1.0 Strict//EN, http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd) +SAX.startElement(html, xmlns='http://www.w3.org/1999/xhtml') +SAX.ignorableWhitespace( + , 2) +SAX.startElement(head) +SAX.ignorableWhitespace( + , 3) +SAX.startElement(meta, http-equiv='Content-Type', content='text/html; charset=UTF-8') +SAX.endElement(meta) +SAX.ignorableWhitespace( +, 1) +SAX.startElement(title) +SAX.characters(Test Page, 9) +SAX.endElement(title) +SAX.ignorableWhitespace( +, 1) +SAX.endElement(head) +SAX.ignorableWhitespace( +, 1) +SAX.startElement(body) +SAX.ignorableWhitespace( +, 1) +SAX.startElement(div, id='portal') +SAX.characters( +, 1) +SAX.startElement(script, type='text/javascript') +SAX.cdata( + documen.write("Př, 74) +SAX.endElement(script) +SAX.characters( + , 2) +SAX.startElement(p) +SAX.characters( + Příliš , 58) +SAX.endElement(p) +SAX.characters( +, 1) +SAX.endElement(div) +SAX.ignorableWhitespace( +, 1) +SAX.endElement(body) +SAX.ignorableWhitespace( +, 1) +SAX.endElement(html) +SAX.ignorableWhitespace( + +, 2) +SAX.endDocument() diff --git a/test/HTML/script2.html b/test/HTML/script2.html new file mode 100644 index 00000000..2606a832 --- /dev/null +++ b/test/HTML/script2.html @@ -0,0 +1,19 @@ + + + + +Test Page + + +
+ +

+ Příliš žluťoučký kůň úpěl ďábelksé ódy; +

+
+ + +