aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--encoding.c5
-rw-r--r--result/valid/UTF16Entity.xml8
-rw-r--r--result/valid/UTF16Entity.xml.err0
-rw-r--r--test/valid/UTF16Entity.xml8
-rw-r--r--test/valid/dtds/utf16b.entbin0 -> 98 bytes
-rw-r--r--test/valid/dtds/utf16l.entbin0 -> 98 bytes
7 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index dfede894..fd7ddbf0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Mar 6 15:23:10 CET 2008 Daniel Veillard <daniel@veillard.com>
+
+ * encoding.c: poblem with encoding detection for UTF-16 reported by
+ Ashwin and found by Bill
+ * test/valid/dtds/utf16b.ent test/valid/dtds/utf16l.ent
+ test/valid/UTF16Entity.xml result/valid/UTF16Entity.xml*: added
+ the example to the regression tests
+
Tue Mar 4 14:16:38 CET 2008 Daniel Veillard <daniel@veillard.com>
* xmlwriter.c: patch from Alex Khesin fixing CDATA output after
diff --git a/encoding.c b/encoding.c
index ee5ac390..6d7a4cec 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1768,9 +1768,10 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
* echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
* 45 chars should be sufficient to reach the end of the encoding
* declaration without going too far inside the document content.
+ * on UTF-16 this means 90bytes, on UCS4 this means 180
*/
- if (toconv > 45)
- toconv = 45;
+ if (toconv > 180)
+ toconv = 180;
if (toconv * 2 >= written) {
xmlBufferGrow(out, toconv);
written = out->size - out->use - 1;
diff --git a/result/valid/UTF16Entity.xml b/result/valid/UTF16Entity.xml
new file mode 100644
index 00000000..63cbba22
--- /dev/null
+++ b/result/valid/UTF16Entity.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE foo [
+<!ELEMENT foo (root)*>
+<!ELEMENT root EMPTY>
+<!ENTITY utf16b SYSTEM "dtds/utf16b.ent">
+<!ENTITY utf16l SYSTEM "dtds/utf16l.ent">
+]>
+<foo> &utf16b; &utf16l; </foo>
diff --git a/result/valid/UTF16Entity.xml.err b/result/valid/UTF16Entity.xml.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/valid/UTF16Entity.xml.err
diff --git a/test/valid/UTF16Entity.xml b/test/valid/UTF16Entity.xml
new file mode 100644
index 00000000..8bb29ac1
--- /dev/null
+++ b/test/valid/UTF16Entity.xml
@@ -0,0 +1,8 @@
+<!DOCTYPE foo [
+<!ELEMENT foo (root*)>
+<!ELEMENT root EMPTY>
+<!ENTITY utf16b SYSTEM "dtds/utf16b.ent">
+<!ENTITY utf16l SYSTEM "dtds/utf16l.ent">
+]>
+
+<foo> &utf16b; &utf16l; </foo>
diff --git a/test/valid/dtds/utf16b.ent b/test/valid/dtds/utf16b.ent
new file mode 100644
index 00000000..52c7e2d1
--- /dev/null
+++ b/test/valid/dtds/utf16b.ent
Binary files differ
diff --git a/test/valid/dtds/utf16l.ent b/test/valid/dtds/utf16l.ent
new file mode 100644
index 00000000..2cad40a3
--- /dev/null
+++ b/test/valid/dtds/utf16l.ent
Binary files differ