--- HttpMethodDirectorOriginal.java 2006-11-16 12:31:06.968750000 +0100 +++ HttpMethodDirector.java 2006-11-16 12:40:40.421875000 +0100 @@ -595,7 +595,22 @@ this.conn.getPort(), method.getPath() ); - redirectUri = new URI(location, true); + + /* + * Handles redirections to encoded URI locations + * (only if URI and Connection encoding charset has been properly setted) + * */ + try{ + redirectUri = new URI(location, true); + }catch(URIException ue){ + Object encoding = this.conn.getParams().getParameter("http.protocol.element-charset"); + if(encoding != null){ + redirectUri = new URI(location, false, (String)encoding); + }else{ + throw ue; + } + } + if (redirectUri.isRelativeURI()) { if (this.params.isParameterTrue(HttpClientParams.REJECT_RELATIVE_REDIRECT)) { LOG.warn("Relative redirect location '" + location + "' not allowed");