Since Spring Web version 6.2 there is a UriComponentsBuilder method that supports lax parsing like browsers do. You can try something like:
URI uri = UriComponentsBuilder.fromUriString(malformedUrl, ParserType.WHAT_WG).build().toUri();