New patch to also address the following issues:
- URL decoding should use UTF-8
- URL decoding should be lenient
Rationale for 1. is to bring the method in sync with the behavior of the decoding done by the JDK, i.e. the output from
URI url = new URI("file:/home/%C3%A4%C3%B6%C3%BC%C3%9F");
Rationale for 2. is to better work with invalid URLs returned by bad class loaders. There are still enough class loader implementations out that will return a URL like "file:/<snip>/%file.txt" when queried for a resource named "%file.txt", i.e. the URL is not encoded at all and can as such potentially include literal percent characters. Hence I believe it is preferable for the method to simply pass such characters literally through instead of failing with an exception.