--- xmlschemastypes.c~	2008-04-03 10:02:14.000000000 +0000
+++ xmlschemastypes.c	2009-03-03 03:59:55.000000000 +0000
@@ -2899,12 +2899,23 @@
         case XML_SCHEMAS_ANYURI:{		
                 if (*value != 0) {
 		    xmlURIPtr uri;
+		    xmlChar *tmpval, *cur;
 		    if (normOnTheFly) {		    
 			norm = xmlSchemaCollapseString(value);
 			if (norm != NULL)
 			    value = norm;
 		    }
-                    uri = xmlParseURI((const char *) value);
+		    tmpval = xmlStrdup(value);
+		    for (cur = tmpval; *cur; ++cur) {
+			if (*cur < 32 || *cur >= 127 || *cur == ' ' ||
+			    *cur == '<' || *cur == '>' || *cur == '"' ||
+			    *cur == '{' || *cur == '}' || *cur == '|' ||
+			    *cur == '\\' || *cur == '^' || *cur == '`' ||
+			    *cur == '\'')
+			    *cur = '_';
+		    }
+                    uri = xmlParseURI((const char *) tmpval);
+		    xmlFree(tmpval);
                     if (uri == NULL)
                         goto return1;
                     xmlFreeURI(uri);
