It turned out that my patch was incomplete. Fixing the bug in rng-uri-file-name-1 revealed another bug in rng-uri-unescape-unibyte. The anonymous function passed to replace-regexp-in-string returned a number (e.g. 32 for space) but replace-regexp-in-string expected a string as the return value. I therefore added a call to "string" to convert the number back to a string (e.g. " "). With this fix I was finally able to use a RELAX-NG schema file in a path containing spaces. I made the same fix in rng-uri-unescape-unibyte-match because it was also obviously wrong (regexp-quote expects a string). However, it would be good if someone more familiar with this code (and Lisp in general) could check all the other occurrences of replace-regexp-in-string to make sure they do not contain the same bug. Find attached the expanded patch.