1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-22 21:57:21 +03:00

patch from Dodji Seketeli about UTF16 BOM when using the push XML parser.

* parserInternals.c: patch from Dodji Seketeli about UTF16 BOM
  when using the push XML parser.
* result/utf16bom.xml result/noent/utf16bom.xml test/utf16bom.xml:
  added the test to the regression suite.
Daniel
This commit is contained in:
Daniel Veillard 2003-07-16 21:18:19 +00:00
parent 2009c4ed4d
commit 2dcb937a9a
5 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,10 @@
Wed Jul 16 23:15:53 CEST 2003 Daniel Veillard <daniel@veillard.com>
* parserInternals.c: patch from Dodji Seketeli about UTF16 BOM
when using the push XML parser.
* result/utf16bom.xml result/noent/utf16bom.xml test/utf16bom.xml:
added the test to the regression suite.
Tue Jul 15 22:03:13 CEST 2003 Daniel Veillard <daniel@veillard.com>
* globals.c: add xmlThrDefMutex = NULL in xmlCleanupGlobals()

View File

@ -1621,6 +1621,23 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
ctxt->input->cur += 3;
}
return(0);
case XML_CHAR_ENCODING_UTF16LE:
case XML_CHAR_ENCODING_UTF16BE:
/*The raw input characters are encoded
*in UTF-16. As we expect this function
*to be called after xmlCharEncInFunc, we expect
*ctxt->input->cur to contain UTF-8 encoded characters.
*So the raw UTF16 Byte Order Mark
*has also been converted into
*an UTF-8 BOM. Let's skip that BOM.
*/
if ((ctxt->input != NULL) &&
(ctxt->input->cur[0] == 0xEF) &&
(ctxt->input->cur[1] == 0xBB) &&
(ctxt->input->cur[2] == 0xBF)) {
ctxt->input->cur += 3;
}
break ;
default:
break;
}

BIN
result/noent/utf16bom.xml Normal file

Binary file not shown.

BIN
result/utf16bom.xml Normal file

Binary file not shown.

BIN
test/utf16bom.xml Normal file

Binary file not shown.