Handle poorly encoded queries that are not supported by java.net.URI, close #942