Description
Andreas Hartl opened SPR-6005 and commented
org.springframework.beans.propertyeditors.URIEditor does a double escaping of URLs with a schema that use % escaping.
Test:
System.out.println(new SimpleTypeConverter().convertIfNecessary("http://de.wikipedia.org/wiki/%C3%96", URI.class));
prints
http://de.wikipedia.org/wiki/%25C3%2596
I ran into this behavior when I wanted to make use of URIEditor's feature that it can resolve classpath: URLs. If the classpath contains spaces or other characters that need to be escaped in URLs, then the resulting URI contains double escaped % signs.
My current workaround is to extend URIEditor and override createURI to always return new URI(value). when registered as custom editor for URIs, this PropertyEditor returns the proper URI.
Affects: 3.0 M3
Attachments:
- SPR-6005-URIEditor-patch.txt (2.44 kB)
Issue Links:
- URIEditor should not double escape classpath: URIs [SPR-16581] #21123 URIEditor should not double escape classpath: URIs
Referenced from: commits 7ec9f15