allow [ and ] in fragment identifiers, 3986 disallow them but it's widely

* uri.c: allow [ and ] in fragment identifiers, 3986 disallow them
  but it's widely used for XPointer, and would break DocBook
  processing among others
Daniel

svn path=/trunk/; revision=3765
diff --git a/ChangeLog b/ChangeLog
index 8112c9e..af316f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Aug  6 12:24:33 CEST 2008 Daniel Veillard <daniel@veillard.com>
+
+	* uri.c: allow [ and ] in fragment identifiers, 3986 disallow them
+	  but it's widely used for XPointer, and would break DocBook
+	  processing among others
+
 Wed Aug  6 11:32:21 CEST 2008 Daniel Veillard <daniel@veillard.com>
 
 	* dict.c: change the big key algorithm to work properly with QName
diff --git a/uri.c b/uri.c
index 38a6253..b34608a 100644
--- a/uri.c
+++ b/uri.c
@@ -201,7 +201,11 @@
  *
  * Parse the query part of an URI
  *
- * query = *uric
+ * fragment      = *( pchar / "/" / "?" )
+ * NOTE: the strict syntax as defined by 3986 does not allow '[' and ']'
+ *       in the fragment identifier but this is used very broadly for
+ *       xpointer scheme selection, so we are allowing it here to not break
+ *       for example all the DocBook processing chains.
  *
  * Returns 0 or the error code
  */
@@ -216,6 +220,7 @@
     cur = *str;
 
     while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') ||
+           (*cur == '[') || (*cur == ']') ||
            ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))
         NEXT(cur);
     if (uri != NULL) {